* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
  }

  body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 2rem 1rem;
  }

  .container {
    max-width: 1200px;
    margin: 0 auto;
  }

  .card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    backdrop-filter: blur(10px);
    margin-bottom: 2rem;
  }

  .header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 3rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
  }

  .header::before {
    content: '✨';
    position: absolute;
    font-size: 6rem;
    opacity: 0.1;
    top: -1rem;
    right: 2rem;
    animation: twinkle 3s ease-in-out infinite;
  }

  .header::after {
    content: '🌙';
    position: absolute;
    font-size: 4rem;
    opacity: 0.1;
    bottom: 1rem;
    left: 2rem;
    animation: float 4s ease-in-out infinite;
  }

  @keyframes twinkle {
    0%, 100% { opacity: 0.1; transform: scale(1); }
    50% { opacity: 0.2; transform: scale(1.1); }
  }

  @keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
  }

  h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
  }

  .subtitle {
    font-size: 1rem;
    opacity: 0.9;
  }

  .form-content {
    padding: 2.5rem;
  }

  .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
  }

  .form-group {
    margin-bottom: 1.5rem;
  }

  label {
    display: block;
    margin-bottom: 0.5rem;
    color: #4a5568;
    font-weight: 600;
    font-size: 0.95rem;
  }

  input[type="text"],
  input[type="date"],
  input[type="time"],
  input[type="number"],
  select {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
  }

  input:focus,
  select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
  }

  .autocomplete-wrapper {
    position: relative;
  }

  .autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #667eea;
    border-radius: 12px;
    margin-top: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    display: none;
  }

  .autocomplete-dropdown.show {
    display: block;
  }

  .autocomplete-item {
    padding: 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
  }

  .autocomplete-item:hover {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
  }

  .autocomplete-item:last-child {
    border-bottom: none;
  }

  .autocomplete-empty {
    padding: 1rem;
    text-align: center;
    color: #718096;
  }

  .city-name {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.25rem;
  }

  .city-meta {
    font-size: 0.85rem;
    color: #718096;
  }

  .place-result {
    margin-top: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 12px;
    border-left: 4px solid #667eea;
  }

  .submit-btn {
    width: 100%;
    padding: 1.25rem;
    background: linear-gradient(135deg, #fdcb6e 0%, #e17055 100%);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 1.125rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 8px 20px rgba(253, 203, 110, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
  }

  .submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(253, 203, 110, 0.5);
  }

  .submit-btn:active {
    transform: translateY(0);
  }

  .info-box {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    border-left: 4px solid #667eea;
  }

  .info-box p {
    color: #4a5568;
    line-height: 1.6;
    margin: 0;
  }

  .error-box {
    background: #fee;
    border-left: 4px solid #e53e3e;
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
  }

  .error-box h3 {
    color: #c53030;
    margin-bottom: 0.5rem;
  }

  .error-box ul {
    list-style: none;
    color: #742a2a;
  }

  .error-box li {
    margin: 0.25rem 0;
  }

  .flash {
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
  }

  .flash.error {
    background: #fee;
    border-left: 4px solid #e53e3e;
    color: #742a2a;
  }

  .flash.success {
    background: #d4edda;
    border-left: 4px solid #28a745;
    color: #155724;
  }

  /* Charts Section */
  .charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
  }

  .chart-wrapper {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  }

  .chart-container h2 {
    color: #2d3748;
    margin-bottom: 1rem;
    font-size: 1.5rem;
    text-align: center;
  }

  .chart-box {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-radius: 12px;
    padding: 1rem;
  }

  /* Details Section */
  .details-section {
    margin: 2rem 0;
  }

  .details-section h2 {
    color: #2d3748;
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2rem;
  }

  .details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
  }

  .box {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-top: 4px solid #667eea;
  }

  .box.full-width {
    grid-column: 1 / -1;
  }

  .box h3 {
    color: #2d3748;
    margin-bottom: 1rem;
    font-size: 1.25rem;
  }

  .kv {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e2e8f0;
  }

  .kv:last-child {
    border-bottom: none;
  }

  .kv div:first-child {
    color: #718096;
  }

  .kv div:last-child {
    font-weight: 600;
    color: #2d3748;
  }

  /* Dasha Section */
  .dasha-list {
    margin-top: 1rem;
  }

  .maha-item {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-radius: 12px;
    margin-bottom: 1rem;
    padding: 1rem;
    border-left: 4px solid #667eea;
  }

  .maha-item summary {
    cursor: pointer;
    font-weight: 600;
    color: #2d3748;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .maha-item summary::-webkit-details-marker {
    display: none;
  }

  .maha-duration {
    background: linear-gradient(135deg, #fdcb6e 0%, #e17055 100%);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
  }

  .antardashas {
    margin-top: 1rem;
    padding-left: 1rem;
  }

  .antardasha-row {
    padding: 0.75rem;
    background: white;
    border-radius: 8px;
    margin-bottom: 0.5rem;
  }

  .small-meta {
    font-size: 0.85rem;
    color: #718096;
    margin-bottom: 1rem;
  }

  /* Planet Table */
  .table-wrap {
    overflow-x: auto;
    margin: 1.5rem 0;
  }

  .planet-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
  }

  .planet-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
  }

  .planet-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
  }

  .planet-table td {
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
  }

  .planet-table tr:last-child td {
    border-bottom: none;
  }

  .planet-table tbody tr:hover {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
  }

  .planet-name {
    font-weight: 600;
    color: #2d3748;
  }

  .icon {
    font-size: 1.25rem;
    margin-right: 0.5rem;
  }

  .retro {
    color: #e17055;
    font-size: 1.1rem;
    margin-left: 0.25rem;
  }

  .legend {
    margin-top: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-radius: 12px;
    font-size: 0.9rem;
    color: #4a5568;
  }

  .legend span {
    margin-right: 1.5rem;
    display: inline-block;
  }

  /* Predictions */
  .predictions-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
  }

  .prediction-box {
    background: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-top: 4px solid #fdcb6e;
  }

  .prediction-box h3 {
    color: #2d3748;
    margin-bottom: 1rem;
    font-size: 1.25rem;
  }

  .prediction-box p {
    color: #4a5568;
    line-height: 1.8;
  }

  .cta-marriage {
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(240, 147, 251, 0.4);
  }

  .cta-marriage:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(240, 147, 251, 0.5);
  }

  .center {
    text-align: center;
  }

  .mt24 {
    margin-top: 1.5rem;
  }

  .mt32 {
    margin-top: 2rem;
  }

  @media (max-width: 768px) {
    .form-row {
      grid-template-columns: 1fr;
    }

    .coords-grid {
      grid-template-columns: 1fr;
    }

    h1 {
      font-size: 2rem;
    }

    .form-content {
      padding: 1.5rem;
    }

    .charts-container {
      grid-template-columns: 1fr;
    }

    .details-grid {
      grid-template-columns: 1fr;
    }

    .predictions-row {
      grid-template-columns: 1fr;
    }
  }

  .muted {
    color: #718096;
    font-size: 0.9rem;
  }

  strong {
    color: #2d3748;
  }
/* ========== IMPROVED MESSAGES & ERROR DISPLAY ========== */
  
  /* Flash Messages */
  .messages-container {
    margin-bottom: 1.5rem;
  }

  .flash {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    animation: slideIn 0.3s ease-out;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  @keyframes slideIn {
    from {
      opacity: 0;
      transform: translateY(-10px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  .flash::before {
    content: '';
    font-size: 1.5rem;
    flex-shrink: 0;
  }

  .flash.error {
    background: linear-gradient(135deg, #fee 0%, #fdd 100%);
    border: 1px solid #f5c6cb;
    border-left: 4px solid #e53e3e;
    color: #721c24;
  }

  .flash.error::before {
    content: '❌';
  }

  .flash.success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    border: 1px solid #c3e6cb;
    border-left: 4px solid #28a745;
    color: #155724;
  }

  .flash.success::before {
    content: '✅';
  }

  .flash.warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    border: 1px solid #ffeaa7;
    border-left: 4px solid #fdcb6e;
    color: #856404;
  }

  .flash.warning::before {
    content: '⚠️';
  }

  .flash.info {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    border: 1px solid #bee5eb;
    border-left: 4px solid #17a2b8;
    color: #0c5460;
  }

  .flash.info::before {
    content: 'ℹ️';
  }

  .flash-content {
    flex: 1;
    line-height: 1.6;
  }

  .flash-close {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
    padding: 0;
    margin-left: auto;
    color: inherit;
  }

  .flash-close:hover {
    opacity: 1;
  }

  /* Enhanced Error Box */
  .error-box {
    background: linear-gradient(135deg, #fff5f5 0%, #fed7d7 100%);
    border: 2px solid #fc8181;
    border-left: 6px solid #e53e3e;
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.15);
    animation: slideIn 0.3s ease-out;
  }

  .error-box-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #fc8181;
  }

  .error-box-icon {
    font-size: 2rem;
    animation: shake 0.5s ease-in-out;
  }

  @keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
  }

  .error-box h3 {
    color: #c53030;
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
  }

  .error-box ul {
    list-style: none;
    padding: 0;
    margin: 0;
  }

  .error-box li {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: white;
    border-radius: 8px;
    color: #742a2a;
    border-left: 3px solid #e53e3e;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  }

  .error-box li:last-child {
    margin-bottom: 0;
  }

  .error-box li::before {
    content: '•';
    color: #e53e3e;
    font-weight: bold;
    font-size: 1.25rem;
    flex-shrink: 0;
  }

  .error-field {
    font-weight: 700;
    color: #c53030;
  }

  .error-message {
    color: #742a2a;
  }

  /* API Error Display (for AJAX responses) */
  .api-error-box {
    background: linear-gradient(135deg, #fff5f5 0%, #fed7d7 100%);
    border: 2px solid #fc8181;
    border-radius: 16px;
    padding: 1.5rem;
    margin: 1rem 0;
    animation: slideIn 0.3s ease-out;
  }

  .api-error-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    color: #c53030;
  }

  .api-error-icon {
    font-size: 2rem;
  }

  .api-error-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
  }

  .api-error-message {
    color: #742a2a;
    margin: 0.5rem 0;
    line-height: 1.6;
    background: white;
    padding: 1rem;
    border-radius: 8px;
    border-left: 3px solid #e53e3e;
  }

  .api-error-suggestion {
    background: rgba(255, 255, 255, 0.7);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: #856404;
    border-left: 3px solid #fdcb6e;
  }

  .api-error-suggestion::before {
    content: '💡 ';
    font-size: 1rem;
  }

  .api-error-details {
    margin-top: 1rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #4a5568;
    border: 1px solid #e2e8f0;
  }

  .api-error-details-title {
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 0.5rem;
  }

  .api-error-code {
    display: inline-block;
    background: #742a2a;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-left: 0.5rem;
  }

  /* Success Box (for positive feedback) */
  .success-box {
    background: linear-gradient(135deg, #f0fff4 0%, #c6f6d5 100%);
    border: 2px solid #68d391;
    border-left: 6px solid #28a745;
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.15);
    animation: slideIn 0.3s ease-out;
  }

  .success-box-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
  }

  .success-box-icon {
    font-size: 2rem;
  }

  .success-box h3 {
    color: #22543d;
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
  }

  .success-box p {
    color: #2f855a;
    margin: 0;
    line-height: 1.6;
  }

  /* Loading/Processing State */
  .processing-box {
    background: linear-gradient(135deg, #ebf8ff 0%, #bee3f8 100%);
    border: 2px solid #90cdf4;
    border-left: 6px solid #3182ce;
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    animation: slideIn 0.3s ease-out;
  }

  .processing-icon {
    font-size: 3rem;
    animation: spin 2s linear infinite;
    display: inline-block;
    margin-bottom: 0.5rem;
  }

  @keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
  }

  .processing-text {
    color: #2c5282;
    font-weight: 600;
    margin: 0;
  }

  /* Responsive adjustments */
  @media (max-width: 768px) {
    .error-box,
    .api-error-box,
    .success-box {
      padding: 1rem;
      border-radius: 12px;
    }

    .flash {
      padding: 0.875rem 1rem;
    }

    .error-box-header,
    .api-error-header,
    .success-box-header {
      flex-direction: row;
      align-items: center;
    }

    .error-box-icon,
    .api-error-icon,
    .success-box-icon {
      font-size: 1.5rem;
    }
  }
