/* Index Page Complete CSS - Fixed & Stable */

/* CSS Variables */
:root {
    --primary: #667eea;
    --secondary: #764ba2;
    --accent: #f093fb;
    --gold: #ffd700;
}

/* Prevent horizontal scrolling */
body {
    overflow-x: hidden;
    max-width: 100%;
    width: 100%;
}

/* REMOVED PROBLEMATIC CONTAINER STYLES - Let Bootstrap handle containers */

/* Hero Section */
.hero-section {
    position: relative;
    height: 70vh;
    background: 
        radial-gradient(circle at 20% 80%, rgba(102, 126, 234, 0.4) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(118, 75, 162, 0.4) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 219, 255, 0.3) 0%, transparent 50%),
        linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 4rem;
}

/* Animated Background Elements */
.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='20' cy='20' r='1.5' fill='%23ffffff' opacity='0.6'/%3E%3Ccircle cx='80' cy='40' r='1' fill='%23ffffff' opacity='0.4'/%3E%3Ccircle cx='40' cy='80' r='2' fill='%23ffffff' opacity='0.8'/%3E%3Ccircle cx='60' cy='20' r='1.2' fill='%23ffffff' opacity='0.5'/%3E%3Ccircle cx='30' cy='60' r='1.8' fill='%23ffffff' opacity='0.7'/%3E%3C/svg%3E");
    animation: floatParticles 20s linear infinite;
}

@keyframes floatParticles {
    0% { transform: translateY(0px) translateX(0px); }
    25% { transform: translateY(-20px) translateX(10px); }
    50% { transform: translateY(-10px) translateX(-10px); }
    75% { transform: translateY(10px) translateX(15px); }
    100% { transform: translateY(0px) translateX(0px); }
}

/* Floating NCC Badges */
.hero-badges {
    position: absolute;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.hero-badge {
    position: absolute;
    font-size: 2rem;
    opacity: 0.1;
    animation: floatBadge 15s linear infinite;
}

.hero-badge:nth-child(1) { top: 20%; left: 10%; animation-delay: 0s; }
.hero-badge:nth-child(2) { top: 60%; left: 80%; animation-delay: -5s; }
.hero-badge:nth-child(3) { top: 80%; left: 20%; animation-delay: -10s; }
.hero-badge:nth-child(4) { top: 40%; left: 90%; animation-delay: -7s; }

@keyframes floatBadge {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    25% { transform: translateY(-20px) rotate(90deg); }
    50% { transform: translateY(0px) rotate(180deg); }
    75% { transform: translateY(20px) rotate(270deg); }
}

.hero-content {
    text-align: center;
    color: white;
    z-index: 2;
    position: relative;
    width: 90%;
    max-width: 1200px;
    padding: 20px;
}

.ncc-logo {
    width: 150px;
    height: 150px;
    margin-bottom: 2rem;
    animation: floatLogo 4s ease-in-out infinite;
    filter: 
        drop-shadow(0 15px 30px rgba(0,0,0,0.4))
        brightness(1.1);
    position: relative;
}

.ncc-logo::after {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 70%);
    border-radius: 50%;
    animation: pulseGlow 3s ease-in-out infinite;
    z-index: -1;
}

@keyframes floatLogo {
    0%, 100% { 
        transform: translateY(0px) scale(1); 
    }
    50% { 
        transform: translateY(-15px) scale(1.05); 
    }
}

@keyframes pulseGlow {
    0%, 100% { opacity: 0.5; transform: scale(1); }
    50% { opacity: 0.8; transform: scale(1.1); }
}

.hero-title {
    font-size: 4rem;
    font-weight: 800;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fff 0%, #f0f0f0 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 5px 15px rgba(0,0,0,0.3);
    animation: titleSlideIn 1.5s ease-out;
}

.hero-subtitle {
    font-size: 1.5rem;
    opacity: 0.9;
    font-weight: 300;
    margin-bottom: 2rem;
    animation: subtitleSlideIn 1.8s ease-out;
}

@keyframes titleSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes subtitleSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 0.9;
        transform: translateY(0);
    }
}

/* Modern Cards - Animated */
.modern-card {
    border: none;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
    transition: all 0.3s ease;
    background: white;
    margin-bottom: 2rem;
    width: 100%;
}

.modern-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.hierarchy-img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: 15px;
    padding: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Hierarchy Section - Fixed & Stable (No Animations) */
.hierarchy-card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    background: white;
    margin-bottom: 2rem;
    transition: none !important;
}

.hierarchy-card:hover {
    transform: none !important;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08) !important;
}

.hierarchy-img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    border-radius: 10px;
    padding: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: none !important;
}

/* Ensure hierarchy cards don't animate */
.hierarchy-card .card-body,
.hierarchy-card .card-title,
.hierarchy-card .card-text {
    transition: none !important;
}

/* Leaders Section - Animated */
.leader-card {
    border: none;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    transition: all 0.4s ease;
    background: white;
    position: relative;
    width: 100%;
}

.leader-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--gold), var(--accent));
    z-index: 2;
}

.leader-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 25px 50px rgba(0,0,0,0.15);
}

.leader-portrait-container {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 350px;
    padding: 20px;
    width: 100%;
}

.leader-card img {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: contain;
    object-position: center;
    transition: all 0.4s ease;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.leader-card img.loaded {
    animation: none;
    background: none;
}

.leader-card:hover img {
    transform: scale(1.03);
    filter: brightness(1.05);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.rank-ribbon {
    position: absolute;
    top: 20px;
    right: -5px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 8px 20px;
    font-size: 0.8rem;
    font-weight: 600;
    border-radius: 4px 0 0 4px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 3;
}

.rank-ribbon::before {
    content: '';
    position: absolute;
    top: 0;
    right: -10px;
    width: 0;
    height: 0;
    border-left: 10px solid var(--secondary);
    border-top: 10px solid transparent;
    border-bottom: 10px solid transparent;
}

.leader-card .card-body {
    background: linear-gradient(135deg, #ffffff, #f8f9fa);
    position: relative;
    z-index: 2;
    padding: 1.5rem;
    width: 100%;
}

.leader-card .card-title {
    position: relative;
    padding-bottom: 15px;
    margin-bottom: 20px;
    font-weight: 700;
    color: var(--primary);
}

.leader-card .card-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--gold));
    border-radius: 2px;
}

.leader-bio {
    line-height: 1.7;
    color: #555;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.leader-stats {
    background: rgba(26, 54, 93, 0.05);
    border-radius: 15px;
    padding: 15px;
    margin: 20px 0;
}

.stat-item h5 {
    font-weight: 700;
    color: var(--primary) !important;
    margin-bottom: 0.25rem;
}

.stat-item small {
    color: #666;
    font-weight: 500;
    font-size: 0.8rem;
}

.specializations .badge {
    font-size: 0.75rem;
    padding: 6px 12px;
    border-radius: 15px;
    background: linear-gradient(135deg, var(--primary), var(--secondary)) !important;
    border: none;
    margin: 0 2px 5px 0;
}

/* Section Titles */
.section-title {
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 3rem;
    position: relative;
    display: inline-block;
    width: 100%;
    text-align: center;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--gold));
    border-radius: 2px;
}

/* Loading Animation */
@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Ensure proper spacing for all sections */
section {
    padding: 2rem 0;
}

/* ========== DISCLAIMER POPUP FIX ========== */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    padding: 20px;
    backdrop-filter: blur(5px);
    overflow-y: auto;
}

.popup-modal {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border-radius: 20px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    border: 2px solid var(--gold);
    overflow: hidden;
    animation: popupSlideIn 0.5s ease-out;
    position: relative;
    display: flex;
    flex-direction: column;
}

@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.popup-header {
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    padding: 1.5rem;
    text-align: center;
    border-bottom: 2px solid var(--gold);
    position: relative;
    flex-shrink: 0;
}

.popup-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--gold), var(--accent));
}

.popup-title {
    color: white;
    font-weight: 700;
    margin: 0;
    font-size: 1.5rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    z-index: 10;
}

.popup-close:hover {
    background: rgba(255,255,255,0.3);
    transform: rotate(90deg);
}

.popup-body {
    padding: 2rem;
    background: white;
    flex: 1;
    overflow-y: auto;
}

.popup-content {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
}

.popup-image-section {
    flex: 0 0 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.popup-photo-container {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid var(--gold);
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    margin-bottom: 1rem;
}

.popup-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.3s ease;
}

.popup-photo:hover {
    transform: scale(1.05);
}

.popup-badge {
    background: linear-gradient(135deg, var(--accent), var(--secondary));
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.popup-message-section {
    flex: 1;
    overflow-y: auto;
    padding-right: 10px;
}

.popup-message-section::-webkit-scrollbar {
    width: 6px;
}

.popup-message-section::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.popup-message-section::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

.popup-message-section::-webkit-scrollbar-thumb:hover {
    background: var(--secondary);
}

.disclaimer-title {
    color: #d32f2f;
    font-weight: 700;
    font-size: 1.3rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.disclaimer-title i {
    font-size: 1.5rem;
}

.disclaimer-text {
    line-height: 1.7;
    color: #555;
    font-size: 0.95rem;
}

.disclaimer-text p {
    margin-bottom: 1rem;
    text-align: justify;
}

.disclaimer-highlight {
    color: #d32f2f;
    font-weight: 600;
}

.disclaimer-emphasis {
    font-weight: 700;
    color: var(--primary);
}

.disclaimer-note {
    background: linear-gradient(135deg, #fff3e0, #ffecb3);
    border-left: 4px solid var(--gold);
    padding: 1rem;
    border-radius: 0 8px 8px 0;
    margin: 1.5rem 0;
    font-style: italic;
}

.popup-footer {
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    border-top: 1px solid #e0e0e0;
    text-align: center;
    flex-shrink: 0;
}

.popup-button {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    font-size: 1rem;
}

.popup-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    background: linear-gradient(135deg, var(--secondary), var(--primary));
}

/* Stats */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #f8f9fa, #e9ecef);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    border-left: 5px solid #3498db;
}

.stat-card h3 {
    color: #7f8c8d;
    font-size: 1rem;
    margin-bottom: 10px;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: #2c3e50;
}

/* Sample Dates */
.sample-dates h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.date-cards-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* Date Card */
.date-card {
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    border-left: 5px solid #3498db;
    transition: all 0.3s ease;
    cursor: pointer;
}

.date-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

.date-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.date {
    font-size: 1.2rem;
    font-weight: bold;
    color: #2c3e50;
    display: flex;
    align-items: center;
}

.date i {
    margin-right: 10px;
    color: #3498db;
}

.category-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.category-tag {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    color: white;
}

/* Category Colors */
.national { background-color: #FF9933; }
.international { background-color: #2ecc71; }
.armed-forces { background-color: #e74c3c; }
.army { background-color: #8B4513; }
.navy { background-color: #000080; }
.air-force { background-color: #87CEEB; color: #000; }
.health { background-color: #9b59b6; }
.environment { background-color: #27ae60; }
.social { background-color: #f39c12; }
.cultural { background-color: #d35400; }
.education { background-color: #3498db; }
.science { background-color: #16a085; }

.event-name {
    font-size: 1.3rem;
    color: #2c3e50;
    margin-bottom: 10px;
}

.event-objective {
    color: #555;
    line-height: 1.5;
    font-size: 0.95rem;
}

/* Fixed Calendar Button */
.calendar-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #3498db, #8e44ad);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    transition: all 0.3s ease;
    border: none;
    outline: none;
}

.calendar-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.calendar-btn i {
    font-size: 28px;
    margin-bottom: 3px;
}

.calendar-btn span {
    font-size: 12px;
}

/* Calendar Modal */
.calendar-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    overflow-y: auto;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    width: 95%;
    max-width: 1200px;
    margin: 30px auto;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    background: linear-gradient(to right, #2c3e50, #4a6491);
    color: white;
    padding: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.modal-header h2 {
    font-size: 1.8rem;
    flex: 1;
}

.modal-header h2 i {
    margin-right: 10px;
    color: #3498db;
}

.modal-filter {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.modal-filter select, .modal-filter input {
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-size: 1rem;
}

.modal-filter select {
    min-width: 200px;
    background-color: white;
}

.modal-filter input {
    flex: 1;
    min-width: 200px;
}

.close-modal {
    background: none;
    border: none;
    color: white;
    font-size: 32px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.close-modal:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 20px;
    flex: 1;
    overflow-y: auto;
}

.dates-count {
    margin-bottom: 20px;
    font-size: 1.1rem;
    color: #7f8c8d;
    padding: 10px 0;
    border-bottom: 2px solid #eee;
}

.dates-count span {
    font-weight: bold;
    color: #3498db;
}

.dates-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    padding: 10px;
}

.modal-footer {
    padding: 20px;
    background-color: #f8f9fa;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    color: #555;
}

.legend-color {
    width: 15px;
    height: 15px;
    border-radius: 3px;
}

.btn-close {
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-close:hover {
    background-color: #c0392b;
}

/* Month Headers in Modal */
.month-header {
    grid-column: 1 / -1;
    background: linear-gradient(to right, #3498db, #2980b9);
    color: white;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0 10px;
    font-size: 1.4rem;
    font-weight: bold;
}

/* ========== RESPONSIVE FIXES FOR ALL DEVICES ========== */

/* Large Desktop (1200px and above) */
@media (min-width: 1200px) {
    .hero-section {
        height: 75vh;
    }
    
    .hero-title {
        font-size: 4.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.8rem;
    }
}

/* Desktop (992px to 1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
    .hero-section {
        height: 70vh;
    }
    
    .hero-title {
        font-size: 3.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.5rem;
    }
    
    .ncc-logo {
        width: 140px;
        height: 140px;
    }
}

/* Tablet (768px to 991px) */
@media (min-width: 768px) and (max-width: 991px) {
    .hero-section {
        height: 60vh;
        margin-bottom: 3rem;
    }
    
    .hero-title {
        font-size: 3rem;
    }
    
    .hero-subtitle {
        font-size: 1.3rem;
    }
    
    .ncc-logo {
        width: 120px;
        height: 120px;
    }
    
    /* Hierarchy cards - stack images and text */
    .modern-card.d-flex {
        flex-direction: column;
        text-align: center;
        padding: 1.5rem !important;
    }
    
    .hierarchy-img {
        width: 100px;
        height: 100px;
        margin: 0 auto 1.5rem auto !important;
    }
    
    /* Leaders - side by side but smaller */
    #leaders .col-md-5 {
        width: 48%;
    }
    
    .leader-portrait-container {
        min-height: 280px;
    }
    
    .leader-card img {
        max-height: 250px;
    }
    
    /* Popup modal - adjust layout */
    .popup-content {
        gap: 1.5rem;
    }
    
    .popup-photo-container {
        width: 160px;
        height: 160px;
    }
    
    .popup-title {
        padding-right: 40px;
    }
}

/* Mobile Landscape & Small Tablets (576px to 767px) */
@media (min-width: 576px) and (max-width: 767px) {
    .hero-section {
        height: 50vh;
        padding: 15px;
        margin-bottom: 2rem;
    }
    
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1.2rem;
    }
    
    .ncc-logo {
        width: 100px;
        height: 100px;
        margin-bottom: 1.5rem;
    }
    
    .section-title {
        font-size: 1.8rem;
        margin-bottom: 2rem;
    }
    
    /* Hierarchy cards - full width */
    .col-lg-10 {
        width: 100%;
    }
    
    .modern-card {
        padding: 1.5rem !important;
        margin-bottom: 1.5rem;
    }
    
    .hierarchy-img {
        width: 90px;
        height: 90px;
    }
    
    /* Leaders - stack vertically */
    #leaders .row {
        flex-direction: column;
    }
    
    #leaders .col-md-5 {
        width: 100%;
        max-width: 400px;
        margin: 0 auto 2rem auto;
    }
    
    .leader-portrait-container {
        min-height: 250px;
        padding: 15px;
    }
    
    .leader-card img {
        max-height: 220px;
    }
    
    /* Rank structure - 3 columns */
    #ranks .col-md-2,
    #ranks .col-6 {
        flex: 0 0 33.333%;
        max-width: 33.333%;
    }
    
    /* Popup modal - stack layout */
    .popup-overlay {
        padding: 15px;
    }
    
    .popup-modal {
        width: 95%;
        max-height: 95vh;
    }
    
    .popup-content {
        flex-direction: column;
        text-align: center;
        gap: 1.5rem;
    }
    
    .popup-image-section {
        flex: none;
    }
    
    .popup-photo-container {
        width: 150px;
        height: 150px;
        margin: 0 auto 1rem auto;
    }
    
    .popup-message-section {
        max-height: 300px;
        padding-right: 5px;
    }
    
    .popup-title {
        font-size: 1.3rem;
        padding-right: 40px;
    }
    
    .popup-close {
        top: 12px;
        right: 12px;
    }
    
    .popup-button {
        padding: 10px 25px;
        font-size: 0.9rem;
    }
    
    /* Calendar modal - compact */
    .modal-content {
        margin: 15px auto;
        max-height: 85vh;
    }
    
    .modal-header {
        padding: 15px;
    }
    
    .modal-header h2 {
        font-size: 1.3rem;
    }
    
    .modal-filter {
        flex-direction: column;
        width: 100%;
    }
    
    .modal-filter select,
    .modal-filter input {
        width: 100%;
        min-width: auto;
        font-size: 0.9rem;
        padding: 8px 12px;
    }
    
    .dates-container {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .calendar-btn {
        width: 60px;
        height: 60px;
        bottom: 20px;
        right: 20px;
    }
    
    .calendar-btn i {
        font-size: 22px;
    }
}

/* Mobile Portrait (below 576px) */
@media (max-width: 575px) {
    /* Base adjustments */
    body {
        font-size: 14px;
    }
    
    .hero-section {
        height: 45vh;
        padding: 10px;
        margin-bottom: 1.5rem;
    }
    
    .hero-title {
        font-size: 2rem;
        line-height: 1.2;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .ncc-logo {
        width: 80px;
        height: 80px;
        margin-bottom: 1rem;
    }
    
    .section-title {
        font-size: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    /* Hierarchy - compact cards */
    .modern-card {
        padding: 1rem !important;
        margin-bottom: 1rem;
        border-radius: 15px;
    }
    
    .hierarchy-img {
        width: 70px;
        height: 70px;
        margin-bottom: 1rem !important;
    }
    
    /* Leaders - compact */
    .leader-portrait-container {
        min-height: 200px;
        padding: 10px;
    }
    
    .leader-card img {
        max-height: 180px;
    }
    
    .rank-ribbon {
        font-size: 0.7rem;
        padding: 5px 12px;
        top: 10px;
    }
    
    .leader-card .card-body {
        padding: 1rem;
    }
    
    .leader-bio {
        font-size: 0.85rem;
        margin-bottom: 1rem;
    }
    
    .leader-stats {
        padding: 10px;
        margin: 15px 0;
    }
    
    .stat-item h5 {
        font-size: 1rem;
    }
    
    .stat-item small {
        font-size: 0.7rem;
    }
    
    /* Rank structure - 2 columns */
    #ranks .col-md-2,
    #ranks .col-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    
    #ranks .card {
        padding: 10px !important;
    }
    
    /* Popup modal - mobile optimized */
    .popup-overlay {
        padding: 10px;
    }
    
    .popup-modal {
        width: 100%;
        border-radius: 15px;
    }
    
    .popup-header {
        padding: 1rem;
    }
    
    .popup-body {
        padding: 1rem;
    }
    
    .popup-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .popup-photo-container {
        width: 120px;
        height: 120px;
    }
    
    .popup-badge {
        font-size: 0.7rem;
        padding: 5px 10px;
    }
    
    .disclaimer-title {
        font-size: 1.1rem;
        flex-direction: column;
        gap: 5px;
    }
    
    .disclaimer-text {
        font-size: 0.85rem;
    }
    
    .popup-button {
        width: 100%;
        padding: 12px;
    }
    
    /* Calendar modal - mobile compact */
    .calendar-modal {
        padding: 5px;
    }
    
    .modal-content {
        width: 100%;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
        height: 100vh;
    }
    
    .modal-header {
        padding: 12px;
        flex-direction: column;
        gap: 10px;
    }
    
    .modal-header h2 {
        font-size: 1.1rem;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    .modal-header h2 i {
        font-size: 0.9rem;
        margin-right: 5px;
    }
    
    .close-modal {
        position: absolute;
        top: 8px;
        right: 8px;
        width: 28px;
        height: 28px;
        font-size: 20px;
        background: rgba(0,0,0,0.3);
    }
    
    .modal-filter {
        width: 100%;
        flex-direction: column;
        gap: 8px;
    }
    
    .modal-filter select,
    .modal-filter input {
        width: 100%;
        font-size: 0.85rem;
        padding: 6px 10px;
        border-radius: 6px;
    }
    
    .modal-body {
        padding: 12px;
    }
    
    .dates-count {
        font-size: 0.85rem;
        padding: 6px 0;
        margin-bottom: 12px;
    }
    
    .dates-container {
        grid-template-columns: 1fr;
        gap: 8px;
        padding: 5px;
    }
    
    .date-card {
        padding: 10px;
        margin-bottom: 6px;
    }
    
    .date-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        margin-bottom: 8px;
    }
    
    .date {
        font-size: 0.95rem;
    }
    
    .event-name {
        font-size: 1rem;
        margin-bottom: 6px;
    }
    
    .event-objective {
        font-size: 0.8rem;
        line-height: 1.4;
    }
    
    .category-tags {
        gap: 3px;
    }
    
    .category-tag {
        padding: 2px 6px;
        font-size: 0.65rem;
    }
    
    .modal-footer {
        padding: 12px;
        flex-direction: column;
        gap: 12px;
    }
    
    .legend {
        justify-content: center;
        gap: 8px;
    }
    
    .legend-item {
        font-size: 0.7rem;
    }
    
    .legend-color {
        width: 10px;
        height: 10px;
    }
    
    .btn-close {
        width: 100%;
        padding: 8px;
        font-size: 0.85rem;
    }
    
    .month-header {
        padding: 10px;
        font-size: 1rem;
        margin: 12px 0 6px;
    }
    
    /* Calendar button - smaller */
    .calendar-btn {
        width: 50px;
        height: 50px;
        bottom: 15px;
        right: 15px;
    }
    
    .calendar-btn i {
        font-size: 18px;
        margin-bottom: 0;
    }
    
    .calendar-btn span {
        display: none;
    }
    
    /* Reduce animations on very small screens */
    .hero-badges {
        display: none;
    }
    
    .hero-section::before {
        animation-duration: 30s;
    }
}

/* Extra small devices (below 400px) */
@media (max-width: 400px) {
    .hero-title {
        font-size: 1.8rem;
    }
    
    .hero-subtitle {
        font-size: 0.9rem;
    }
    
    .ncc-logo {
        width: 70px;
        height: 70px;
    }
    
    .section-title {
        font-size: 1.3rem;
    }
    
    /* Rank structure - single column */
    #ranks .col-md-2,
    #ranks .col-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    /* Leader stats - vertical layout */
    .leader-stats .row {
        flex-direction: column;
        gap: 10px;
    }
    
    .stat-item {
        padding: 5px;
    }
    
    /* Specializations - vertical badges */
    .specializations .badge {
        display: block;
        margin-bottom: 5px;
        margin-right: 0 !important;
    }
}

/* Landscape mobile optimization */
@media (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        height: 80vh;
        padding: 10px;
    }
    
    .hero-content {
        padding: 10px;
    }
    
    .popup-modal,
    .modal-content {
        max-height: 95vh;
        margin: 5px auto;
    }
    
    .popup-body,
    .modal-body {
        padding: 10px;
    }
    
    .popup-content {
        flex-direction: row;
        gap: 15px;
    }
    
    .popup-photo-container {
        width: 100px;
        height: 100px;
    }
    
    .dates-container {
        grid-template-columns: repeat(2, 1fr);
        max-height: 60vh;
        overflow-y: auto;
    }
}

/* Fix for Bootstrap grid on mobile */
.row {
    margin-left: -10px;
    margin-right: -10px;
}

.col-md-5, .col-md-6, .col-md-4, .col-md-2, .col-6, .col-lg-10 {
    padding-left: 10px;
    padding-right: 10px;
}

/* Ensure all images are responsive */
img {
    max-width: 100%;
    height: auto;
}

/* Prevent layout shifts during animations */
.modern-card,
.leader-card {
    transform-style: preserve-3d;
    backface-visibility: hidden;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Make sure the popup is visible and interactive */
#welcomePopup {
    display: none; /* Hidden by default, shown by JavaScript */
}

#welcomePopup[style*="display: flex"] {
    display: flex !important;
}