:root {
    --primary-green: #1a472a;
    --secondary-green: #2d5e3a;
    --gold: #d4af37;
    --light-brown: #8b7355;
    --bg-light: #f7f4f0;
    --bg-secondary: #ede7df;
    --shadow-primary: rgba(26, 71, 42, 0.1);
}

/* Cultural Success Animation Modal */
.success-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(26, 71, 42, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.success-modal-overlay.show {
    opacity: 1;
}

.success-circle {
    width: min(180px, 40vw);
    height: min(180px, 40vw);
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--secondary-green) 50%, var(--gold) 100%);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 8px 32px rgba(26, 71, 42, 0.4), 0 0 40px rgba(212, 175, 55, 0.3);
    transform: scale(0);
    animation: geometricExpansion 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    position: relative;
    overflow: hidden;
    margin: 20px;
}

.success-circle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.2) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0);
    animation: innerGlow 0.8s ease-out 0.3s forwards;
}

.success-text-ar {
    font-size: clamp(20px, 5vw, 28px);
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    font-family: 'Amiri', 'Cairo', serif;
}

.success-text-en {
    font-size: clamp(12px, 3vw, 16px);
    font-weight: 500;
    opacity: 0.95;
    text-align: center;
    line-height: 1.3;
    font-family: 'Tajawal', sans-serif;
}

@media (max-width: 480px) {
    .success-circle {
        width: min(160px, 45vw);
        height: min(160px, 45vw);
        margin: 15px;
    }
    .success-text-ar {
        margin-bottom: 4px;
    }
}

/* Confetti particles */
.confetti {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--gold);
    opacity: 0;
}

.confetti:nth-child(odd) {
    background: var(--primary-green);
}

.confetti.animate {
    animation: confettiFall 2s ease-out forwards;
}

@keyframes geometricExpansion {
    0% {
        transform: scale(0) rotate(0deg);
        border-radius: 50%;
    }
    30% {
        transform: scale(0.3) rotate(108deg);
        border-radius: 50%;
    }
    60% {
        transform: scale(0.8) rotate(216deg);
        border-radius: 50%;
    }
    100% {
        transform: scale(1) rotate(360deg);
        border-radius: 50%;
    }
}

@keyframes innerGlow {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0;
    }
}

@keyframes confettiFall {
    0% {
        opacity: 1;
        transform: translateY(-20px) rotate(0deg);
    }
    100% {
        opacity: 0;
        transform: translateY(100px) rotate(360deg);
    }
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', 'Cairo', 'Arial', sans-serif;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: linear-gradient(135deg, var(--bg-light) 0%, var(--bg-secondary) 100%);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-overflow-scrolling: touch;
}

.header {
    text-align: center;
    margin-bottom: 20px;
    color: var(--primary-green);
}

.header h1 {
    font-family: 'Amiri', 'Times New Roman', serif;
    background: linear-gradient(45deg, var(--primary-green), var(--secondary-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: clamp(2rem, 5vw, 2.8rem);
    margin-bottom: 10px;
    font-weight: 700;
}

.goast-link {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 15px 0 25px 0;
}

.goast-link a {
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    background: white;
    color: black;
    border: 2px solid var(--gold);
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 48px;
    width: fit-content;
    margin: 0 auto;
}

.goast-logo {
    height: 32px;
    width: auto;
    max-width: 150px; /* Reduced from 210px */
    transition: all 0.3s ease;
    object-fit: contain;
}

.goast-link a:hover {
    background: #f8f6f3;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(212, 175, 55, 0.2);
}

.goast-link a:hover .goast-logo {
    transform: scale(1.05);
}

.tab-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.tab-button {
    padding: 16px 32px;
    border: 2px solid var(--gold);
    background: linear-gradient(145deg, #ffffff, #f8f6f3);
    color: var(--primary-green);
    font-size: 18px;
    font-weight: 600;
    font-family: 'Tajawal', sans-serif;
    cursor: pointer;
    border-radius: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px var(--shadow-primary);
    min-width: 180px;
}

.tab-button:hover {
    background: linear-gradient(145deg, #f8f6f3, var(--bg-secondary));
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(26, 71, 42, 0.15);
}

.tab-button.active {
    background: linear-gradient(45deg, var(--primary-green), var(--secondary-green));
    color: white;
    box-shadow: 0 6px 12px rgba(26, 71, 42, 0.25);
    transform: translateY(-1px);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-subtitle {
    color: var(--light-brown);
    font-size: 1.3rem;
    text-align: center;
    margin-bottom: 20px;
    display: none;
}

.tab-subtitle.show {
    display: block;
}

.search-container {
    background: linear-gradient(145deg, #ffffff, #f8f6f3);
    padding: 30px;
    border-radius: 20px;
    box-shadow: 
        0 16px 45px rgba(26, 71, 42, 0.28),
        0 4px 15px rgba(212, 175, 55, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    margin-bottom: 25px;
    border: 2px solid transparent;
    background-clip: padding-box;
    position: relative;
    overflow: hidden;
}

.search-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(212, 175, 55, 0.1) 0%,
        rgba(26, 71, 42, 0.05) 50%,
        rgba(212, 175, 55, 0.1) 100%
    );
    border-radius: 20px;
    z-index: -1;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 20px;
}

.filter-group label {
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--primary-green);
    font-size: 16px;
    display: block;
    text-align: center;
    position: relative;
    letter-spacing: 0.3px;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
    /* FIX: Add text overflow protection */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Remove golden underline from filter labels */
.filter-group label::after {
    display: none !important;
}

.filter-group input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--gold);
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(145deg, #ffffff, #fefefe);
    font-family: 'Tajawal', sans-serif;
    box-shadow: 
        inset 0 1px 3px rgba(0, 0, 0, 0.05),
        0 1px 0 rgba(255, 255, 255, 0.8);
    position: relative;
}

.filter-group input:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 
        0 0 0 4px rgba(26, 71, 42, 0.12),
        0 4px 12px rgba(26, 71, 42, 0.08),
        inset 0 1px 3px rgba(0, 0, 0, 0.05),
        0 1px 0 rgba(255, 255, 255, 0.8);
    background: linear-gradient(145deg, #ffffff, #fafafa);
    transform: translateY(-1px);
}

.search-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 20px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 600;
    font-family: 'Tajawal', sans-serif;
    transition: all 0.3s ease;
    min-width: 120px;
}

.btn-secondary {
    background: linear-gradient(45deg, var(--light-brown), #a0896b);
    color: white;
    border: 2px solid var(--light-brown);
}

.btn-secondary:hover {
    background: linear-gradient(45deg, #6b5940, var(--light-brown));
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 115, 85, 0.25);
}

.results-container {
    background: linear-gradient(145deg, #ffffff, #f8f6f3);
    border-radius: 15px;
    box-shadow: 0 8px 25px var(--shadow-primary);
    overflow: hidden;
    border: 1px solid var(--gold);
}

.results-header {
    background: linear-gradient(45deg, var(--primary-green), var(--secondary-green));
    color: white;
    padding: 16px 20px;
    font-weight: 600;
    font-size: 20px;
}

/* CRITICAL: Table structure with exact 8-column layout */
.results-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    min-width: 100%;
    max-width: 100%;
}

/* CRITICAL: Ensure all 8 columns always visible with equal width distribution */
.results-table th,
.results-table td {
    width: 12.5% !important;
    min-width: 12.5% !important;
    max-width: 12.5% !important;
    padding: 12px 8px;
    text-align: center;
    vertical-align: middle;
    border-bottom: 1px solid #ddd;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-size: 15px;
    white-space: normal;
    hyphens: auto;
}

.results-table th {
    background: linear-gradient(145deg, var(--bg-light), var(--bg-secondary));
    font-weight: 600;
    color: var(--primary-green);
    border-bottom: 2px solid var(--gold);
    position: sticky;
    top: 0;
    z-index: 1;
    font-size: 16px;
}

.results-table tr:hover {
    background: linear-gradient(145deg, #f9f7f4, #f1ede8);
}

.results-table td a {
    color: var(--primary-green);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(26, 71, 42, 0.05);
    border: 1px solid rgba(26, 71, 42, 0.2);
    word-break: break-all;
}

.results-table td a:hover {
    background: var(--primary-green);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(26, 71, 42, 0.3);
}

.results-table td a[href^="mailto:"] {
    background: rgba(212, 175, 55, 0.1);
    border-color: rgba(212, 175, 55, 0.3);
    color: var(--light-brown);
}

.results-table td a[href^="mailto:"]:hover {
    background: var(--gold);
    color: var(--primary-green);
}

.no-results, .loading {
    text-align: center;
    padding: 30px;
    color: #666;
    font-style: italic;
    font-size: 16px;
}

.loading {
    color: var(--primary-green);
}

/* Performance optimizations */
.results-table tbody {
    contain: layout style;
}

.results-table tr {
    contain: layout;
}

/* CRITICAL: Constrain table wrapper to container */
.table-scroll-wrapper {
    width: 100%;
    max-width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    contain: layout style;
}

/* Mobile layout improvements */
@media (max-width: 768px) {
    body {
        padding: 15px;
    }
    
    .goast-link a {
        font-size: 14px;
    }
    
    .goast-logo {
        max-width: 100px; /* Reduced from 140px */
    }
    
    .search-container {
        padding: 16px;
        border: 1px solid rgba(212, 175, 55, 0.3);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }
    
    .filters-grid {
        display: grid;
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .filter-group label {
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    .filter-group input {
        padding: 10px 14px;
        font-size: 16px;
    }
    
    .search-actions {
        margin-top: 16px;
    }
    
    .tab-container {
        margin-bottom: 20px;
    }
    
    .tab-button {
        padding: 10px 18px;
        font-size: 15px;
    }
    
    .btn {
        min-width: 100px;
        padding: 10px 20px;
        font-size: 16px;
    }
    
    .results-table {
        font-size: 13px;
    }
    
    .results-table th,
    .results-table td {
        padding: 8px 6px;
        font-size: 13px;
    }
    
    .results-table th {
        font-size: 11px;
        line-height: 1.15;
        white-space: normal;
        word-break: break-word;
        padding: 6px 2px;
    }
    
    .results-table td a {
        padding: 3px 6px;
        font-size: 12px;
    }
}

/* Add additional mobile protection for very small screens */
@media (max-width: 480px) {
    body {
        padding: 12px;
    }
    
    .search-container {
        padding: 16px;
    }
    
    .filter-group input {
        padding: 8px 12px;
    }
    
    .tab-button {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .results-table th,
    .results-table td {
        padding: 6px 4px;
        font-size: 12px;
    }
    
    .results-table th {
        font-size: 11px;
    }
    
    .results-table td a {
        font-size: 11px;
    }
    
    .filter-group label {
        font-size: 13px;
    }
}

/* Contact Us FAB & Dialog */
#contact-us-fab {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--primary-green);
  font-size: 24px;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
  transition: opacity 0.2s ease, transform 0.3s ease;
  z-index: 9999;
}
#contact-us-fab.hide {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 80px);
}

/* Overlay */
.contact-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: 9998;
  overflow-y: auto;
}
.contact-overlay.open { opacity: 1; }

/* Dialog / Bottom Sheet */
.contact-dialog {
  background: var(--bg-light);
  width: 90%;
  max-width: 420px;
  border-radius: 16px;
  padding: 20px;
  max-height: calc(100dvh - 40px);
  overflow-y: auto;
  touch-action: pan-y;
  transform: translateY(100%);
  transition: transform 0.3s ease;
  box-sizing: border-box;
}
.contact-overlay.open .contact-dialog { transform: translateY(0); }
@media (max-width: 768px) {
  .contact-overlay {
    align-items: flex-end;
    padding-bottom: 220px;
  }
}

@media (min-width: 769px) {
  .contact-dialog {
    border-radius: 12px;
    max-height: 90vh;
    height: auto;
    transform: scale(0.9);
  }
  .contact-overlay.open .contact-dialog {
    transform: scale(1);
  }
}

.contact-dialog h2 { margin-top: 0; color: var(--primary-green); text-align: center; }
.contact-dialog form { display: flex; flex-direction: column; gap: 12px; }
.contact-dialog input,
.contact-dialog textarea {
  padding: 12px;
  border: 2px solid var(--gold);
  border-radius: 8px;
  font-family: 'Tajawal', sans-serif;
  font-size: 16px;
  resize: vertical;
}
.contact-dialog textarea { min-height: 80px; max-height: 25vh; }
.contact-dialog .honeypot { display: none !important; }
.contact-dialog button[type="submit"] {
  padding: 14px;
  background: linear-gradient(45deg, var(--primary-green), var(--secondary-green));
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 18px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.contact-dialog button[disabled] { opacity: 0.6; cursor: not-allowed; }
.close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--primary-green);
}
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--gold);
  border-top-color: transparent;
  border-radius: 50%;
  margin: 10px auto;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.status-msg { text-align: center; font-weight: 600; }
.status-msg.success { color: var(--primary-green); }
.status-msg.error { color: red; }

/* Toast */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 10px 20px;
  border-radius: 24px;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 10000;
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

body.no-scroll {
  overflow: hidden;
  padding-right: var(--scrollbar-width, 0px);
}

/* Custom scrollbar for table wrapper */
.table-scroll-wrapper::-webkit-scrollbar {
  height: 6px;
}

.table-scroll-wrapper::-webkit-scrollbar-track {
  background: var(--bg-secondary);
  border-radius: 3px;
}

.table-scroll-wrapper::-webkit-scrollbar-thumb {
  background: rgba(45, 94, 58, 0.3);
  border-radius: 3px;
  transition: background 0.3s ease;
}

.table-scroll-wrapper::-webkit-scrollbar-thumb:hover {
  background: rgba(45, 94, 58, 0.5);
}