:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --light-bg: #ecf0f1;
    --white: #ffffff;
    --text-dark: #2c3e50;
    --text-light: #7f8c8d;
    --border-color: #bdc3c7;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--light-bg);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Landing Page */
.landing-page {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.landing-container {
    text-align: center;
    color: var(--white);
    max-width: 800px;
    padding: 20px;
}

.landing-logo {
    margin-bottom: 20px;
}

.landing-logo-img {
    width: 100px;
    height: 100px;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    background: white;
    padding: 2px;
}

.landing-header h1 {
    font-size: 3rem;
    margin-bottom: 10px;
}

.tagline {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 40px;
}

.welcome-section {
    margin-bottom: 40px;
}

.welcome-section h2 {
    font-size: 2rem;
    margin-bottom: 15px;
}

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

.feature-card {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    display: block;
    transition: all 0.3s ease;
}

a.feature-card:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.feature-card h3 {
    margin-bottom: 10px;
}

.login-prompt {
    background: rgba(255, 255, 255, 0.1);
    padding: 30px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
}

.btn-login {
    display: inline-block;
    background: var(--white);
    color: var(--primary-color);
    padding: 12px 30px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    margin-top: 15px;
    transition: transform 0.3s;
}

.btn-login:hover {
    transform: translateY(-2px);
}

.landing-footer {
    margin-top: 40px;
    opacity: 0.8;
}

/* Login Page */
.login-page {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: var(--white);
    padding: 40px;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.login-logo {
    text-align: center;
    margin-bottom: 20px;
}

.login-logo-img {
    width: 80px;
    height: 80px;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.15);
}

.login-box h1 {
    color: var(--primary-color);
    margin-bottom: 10px;
    text-align: center;
}

.login-subtitle {
    color: var(--text-light);
    text-align: center;
    margin-bottom: 30px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-dark);
    font-weight: 500;
}

.login-form input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 16px;
}

.btn-submit {
    width: 100%;
    padding: 12px;
    background: var(--secondary-color);
    color: var(--white);
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-submit:hover {
    background: #2980b9;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
}

.back-link {
    color: var(--text-light);
    text-decoration: none;
}

.back-link:hover {
    color: var(--text-dark);
}

/* Main Header */
.main-header {
    background: var(--primary-color);
    color: var(--white);
    padding: 15px 0;
    box-shadow: var(--shadow);
}

/* Public Navbar Styles */
.navbar {
    background: #0038b8;
    padding: 15px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Fix language switcher alignment in navbar */
.navbar .language-switcher-wrapper,
.nav-right .language-switcher-wrapper {
    display: inline-flex !important;
    align-items: center !important;
    vertical-align: middle !important;
    margin-left: 15px;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-left, .nav-center, .nav-right {
    display: flex;
    align-items: center;
}

.nav-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    text-decoration: none;
    font-weight: bold;
    font-size: 1.2rem;
}

.logo-img {
    width: 40px;
    height: 40px;
    border-radius: 6px;
}

.navbar .nav-menu {
    display: flex;
    list-style: none;
    gap: 10px;
    margin: 0;
    padding: 0;
}

.navbar .nav-menu a {
    color: white;
    padding: 8px 15px;
    text-decoration: none;
    transition: background 0.3s;
    border-radius: 5px;
}

.navbar .nav-menu a:hover {
    background: rgba(255,255,255,0.1);
}

.navbar .btn-primary {
    background: white;
    color: #0038b8;
    padding: 8px 20px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
}

.navbar .btn-primary:hover {
    background: #f0f0f0;
    transform: translateY(-1px);
}

.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 60px;
    position: relative;
    padding: 8px 0;
}

/* Ensure all nav children are vertically centered */
.main-nav > * {
    display: flex;
    align-items: center;
}

/* Language Switcher Container */
.nav-language-container {
    margin-left: auto;
    margin-right: 15px;
    display: flex !important;
    align-items: center !important;
    height: 44px; /* Match hamburger menu height */
}

/* Global fix for language switcher alignment */
.language-switcher-wrapper {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 44px !important;
}

.language-toggle {
    display: inline-flex !important;
    align-items: center !important;
    vertical-align: middle !important;
}

.nav-brand .brand-link {
    color: var(--white);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
}

.site-logo {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
}

.brand-link:hover .site-logo {
    transform: scale(1.1);
}

.site-name {
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-menu {
    display: flex;
    list-style: none;
    align-items: center;
}

.nav-menu li {
    margin-left: 25px;
}

.nav-menu a {
    color: var(--white);
    text-decoration: none;
    transition: opacity 0.3s;
}

.nav-menu a:hover {
    opacity: 0.8;
}

.nav-user {
    position: relative;
    cursor: pointer;
    padding: 10px 0;
}

/* Mobile menu toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    cursor: pointer;
    padding: 5px;
}

.mobile-menu-toggle span {
    width: 25px;
    height: 3px;
    background: white;
    border-radius: 2px;
    transition: all 0.3s;
}

/* Mobile menu */
.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    transition: right 0.3s;
    z-index: 9999;
}

.mobile-menu.active {
    right: 0;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #0038b8;
    color: white;
}

.mobile-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    text-decoration: none;
}

.mobile-logo img {
    width: 30px;
    height: 30px;
}

.close-menu {
    background: none;
    border: none;
    color: white;
    font-size: 30px;
    cursor: pointer;
}

.mobile-nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-nav-list li {
    border-bottom: 1px solid #eee;
}

.mobile-nav-list a {
    display: block;
    padding: 15px 20px;
    color: #333;
    text-decoration: none;
    transition: background 0.3s;
}

.mobile-nav-list a:hover {
    background: #f5f5f5;
}

/* Mobile adjustments for language switcher */
@media (max-width: 768px) {
    .nav-language-container {
        margin-left: auto;
        margin-right: 10px;
        height: 44px;
        display: flex;
        align-items: center;
    }
    
    .mobile-menu-toggle {
        display: flex;
        height: 44px;
        align-items: center;
        margin: 0;
    }
    
    .nav-center, .nav-right .btn-primary {
        display: none;
    }
    
    .mobile-menu {
        display: block;
    }
}

/* Desktop dropdown behavior */
@media (min-width: 769px) {
    .nav-user:hover .dropdown,
    .dropdown:hover {
        display: block;
    }
    
    /* Hide mobile-only items on desktop */
    .mobile-only {
        display: none !important;
    }
}

.dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--white);
    box-shadow: var(--shadow);
    border-radius: 5px;
    padding-top: 5px;
    min-width: 150px;
    z-index: 1000;
}

.dropdown::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    right: 0;
    height: 10px;
    background: transparent;
}

.dropdown li {
    margin: 0;
}

.dropdown a {
    color: var(--text-dark);
    display: block;
    padding: 10px 15px;
}

.dropdown a:hover {
    background: var(--light-bg);
}

/* Dashboard */
.dashboard {
    padding: 40px 0;
    background: var(--white);
    min-height: calc(100vh - 120px);
}

.dashboard h1 {
    margin-bottom: 30px;
    color: var(--primary-color);
}

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

.dashboard-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 30px;
    text-align: center;
    text-decoration: none;
    color: var(--text-dark);
    transition: all 0.3s;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
}

.card-icon {
    font-size: 3rem;
    margin-bottom: 15px;
}

.dashboard-card h3 {
    margin-bottom: 10px;
    color: var(--primary-color);
}

.dashboard-card p {
    color: var(--text-light);
}

.admin-card {
    background: var(--primary-color);
    color: var(--white);
}

.admin-card h3,
.admin-card p {
    color: var(--white);
}

/* Family Members Section on Dashboard */
.family-members-section {
    margin: 40px 0;
    background: var(--white);
    border-radius: 10px;
    padding: 30px;
    box-shadow: var(--shadow);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.section-header h2 {
    margin: 0;
    color: var(--primary-color);
    font-size: 1.5rem;
}

.see-all-link {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
}

.see-all-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.family-members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 20px;
}

.family-member-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    transition: all 0.3s;
}

.family-member-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.member-photo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-size: cover;
    background-position: center;
    margin-bottom: 15px;
    border: 3px solid var(--white);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.member-photo-placeholder {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
}

.member-photo-placeholder span {
    color: white;
    font-size: 2.5rem;
    font-weight: bold;
}

.member-info h4 {
    margin: 0 0 5px 0;
    color: var(--text-dark);
    font-size: 1rem;
}

.member-info .member-role {
    margin: 0;
    color: var(--text-light);
    font-size: 0.85rem;
}

.no-members-message {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

.no-members-message p {
    margin-bottom: 20px;
    font-size: 1.1rem;
}

.recent-activity {
    background: var(--light-bg);
    padding: 30px;
    border-radius: 10px;
}

.recent-activity h2 {
    margin-bottom: 20px;
    color: var(--primary-color);
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    transition: transform 0.2s, box-shadow 0.2s;
}

.activity-item:hover {
    transform: translateX(5px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.activity-icon {
    font-size: 1.5rem;
    min-width: 40px;
    text-align: center;
}

.activity-details {
    flex: 1;
}

.activity-text {
    color: var(--text-color);
    margin-bottom: 5px;
}

.activity-text strong {
    color: var(--primary-color);
}

.activity-time {
    font-size: 0.85rem;
    color: var(--text-light);
}

.no-activity,
.no-content,
.no-trips {
    color: var(--text-light);
    font-style: italic;
}

/* Family Page */
.family-page {
    padding: 40px 0;
    background: var(--white);
    min-height: calc(100vh - 120px);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-header h1 {
    margin: 0;
    color: var(--primary-color);
}

.family-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
}

.member-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 25px;
    text-align: center;
    position: relative;
    transition: box-shadow 0.2s ease;
}

.member-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.member-avatar {
    width: 80px;
    height: 80px;
    background: var(--secondary-color);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    margin: 0 auto 15px;
    border: 3px solid var(--white);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.member-role {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.member-email {
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.member-last-seen {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-top: 10px;
    font-style: italic;
}

.member-bio {
    font-size: 0.9rem;
    color: var(--text-dark);
    margin: 10px 0;
    font-style: italic;
    line-height: 1.4;
}

.member-actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.btn-edit-member,
.btn-delete-member {
    background: transparent;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
    min-width: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-edit-member {
    background: #3498db;
    color: white;
}

.btn-edit-member:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.btn-delete-member {
    background: #e74c3c;
    color: white;
}

.btn-delete-member:hover {
    background: #c0392b;
    transform: translateY(-1px);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background-color: var(--white);
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

.modal-content h2 {
    padding: 24px 24px 16px;
    margin: 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--primary-color);
    flex-shrink: 0;
}

.modal-content form {
    padding: 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    color: var(--text-light);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1;
}

.modal-close:hover,
.modal-close:focus {
    color: var(--danger-color);
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* Mobile modal adjustments */
@media (max-width: 768px) {
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        width: calc(100% - 20px);
        max-width: none;
        max-height: calc(100vh - 40px);
        max-height: calc(100dvh - 40px);
    }
    
    .modal-content h2 {
        padding: 20px 20px 12px;
        font-size: 1.4rem;
    }
    
    .modal-content form {
        padding: 20px;
        padding-bottom: 10px;
    }
    
    .form-actions {
        flex-direction: column;
        margin-top: 10px;
        padding-top: 15px;
    }
    
    .form-actions button {
        width: 100%;
        margin-bottom: 8px;
        padding: 14px;
        font-size: 16px;
        min-height: 50px;
    }
    
    .form-actions button:last-child {
        margin-bottom: 0;
    }
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 16px;
}

.form-group input[type="file"] {
    padding: 8px;
    background: var(--light-bg);
    cursor: pointer;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: var(--text-light);
    font-size: 0.85rem;
}

/* Password visibility toggle */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    padding-right: 45px;
}

.toggle-password {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toggle-password:hover {
    opacity: 0.7;
}

.form-inline {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.form-inline input,
.form-inline select {
    flex: 1;
    min-width: 150px;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-primary {
    background: var(--secondary-color);
    color: var(--white);
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-secondary {
    background: var(--text-light);
    color: var(--white);
}

.btn-secondary:hover {
    background: #5f6c6d;
}

.btn-danger {
    background: var(--danger-color);
    color: var(--white);
    padding: 5px 10px;
    font-size: 14px;
}

.btn-danger:hover {
    background: #c0392b;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th {
    background: var(--primary-color);
    color: var(--white);
    padding: 12px;
    text-align: left;
}

td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

tr:hover {
    background: var(--light-bg);
}

/* Alerts */
.alert {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-error {
    background: #fee;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}

.alert-success {
    background: #e8f5e9;
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

/* Footer */
.main-footer {
    background: var(--primary-color);
    color: var(--white);
    text-align: center;
    padding: 20px 0;
}

/* Page Specific Styles */
.rabbi-sections,
.travel-sections,
.gallery-sections,
.profile-sections,
.admin-sections {
    padding: 20px 0;
}

.rabbi-features {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

.feature-box,
.tool-card {
    background: var(--light-bg);
    padding: 25px;
    border-radius: 10px;
    text-align: center;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--light-bg);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
}

.stat-card h3 {
    font-size: 2rem;
    color: var(--secondary-color);
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
    transition: all 0.2s ease;
}

.mobile-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.mobile-menu-toggle:focus {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
}

.hamburger-line {
    display: block;
    width: 24px;
    height: 3px;
    background: var(--white);
    margin: 2px 0;
    transition: all 0.3s ease;
    border-radius: 2px;
    transform-origin: center;
}

/* Hamburger animation - X transformation */
.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
    transform: translateX(-20px);
}

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* Mobile menu overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    backdrop-filter: blur(2px);
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Responsive Styles */
@media (max-width: 768px) {
    /* Landing page adjustments */
    .landing-header h1 {
        font-size: 2rem;
    }
    
    /* Main navigation mobile styles */
    .main-nav {
        position: relative;
    }
    
    .mobile-menu-toggle {
        display: flex;
    }
    
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100%;
        height: 100vh;
        height: 100dvh; /* Use dynamic viewport height for mobile */
        background: linear-gradient(180deg, var(--primary-color) 0%, #1e2d3d 100%);
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        padding: 0;
        padding-bottom: 20px; /* Padding at bottom */
        transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.3);
        overflow-y: auto; /* Auto scroll when needed */
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        overscroll-behavior: contain; /* Prevent scroll chaining */
    }
    
    /* Mobile menu header */
    .nav-menu::before {
        content: 'Menu';
        display: block;
        width: 100%;
        padding: 20px 20px 12px;
        color: var(--white);
        font-size: 18px;
        font-weight: 600;
        border-bottom: 2px solid rgba(255, 255, 255, 0.1);
        margin-bottom: 8px;
        text-align: center;
        background: rgba(0, 0, 0, 0.1);
        position: sticky;
        top: 0;
        z-index: 10;
    }
    
    .nav-menu.active {
        right: 0;
    }
    
    .nav-menu li {
        margin: 4px 12px;
        width: calc(100% - 24px);
        border-radius: 8px;
        overflow: hidden;
        flex-shrink: 0; /* Prevent items from shrinking */
    }
    
    .nav-menu li:first-child {
        margin-top: 12px;
    }
    
    .nav-menu li a {
        display: flex;
        align-items: center;
        padding: 16px 20px;
        color: var(--white);
        text-decoration: none;
        font-size: 16px;
        font-weight: 500;
        min-height: 44px;
        transition: all 0.2s ease;
        border-radius: 8px;
        position: relative;
    }
    
    .nav-menu li a:hover,
    .nav-menu li a:focus {
        background: rgba(255, 255, 255, 0.15);
        transform: translateX(8px);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }
    
    .nav-menu li a::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        height: 100%;
        width: 4px;
        background: var(--secondary-color);
        transform: scaleY(0);
        transition: transform 0.2s ease;
    }
    
    .nav-menu li a:hover::before,
    .nav-menu li a:focus::before {
        transform: scaleY(1);
    }
    
    /* Hide desktop-only items on mobile */
    .desktop-only {
        display: none !important;
    }
    
    /* Show mobile-only items */
    .mobile-only {
        display: block !important;
    }
    
    /* Mobile user menu */
    .nav-user {
        width: calc(100% - 24px);
        position: relative;
        border-top: 2px solid rgba(255, 255, 255, 0.2);
        margin: 20px 12px 12px;
        padding-top: 16px;
        border-radius: 8px;
    }
    
    .nav-user .user-info {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 18px 20px;
        color: var(--white);
        font-weight: 600;
        font-size: 16px;
        cursor: pointer;
        min-height: 44px;
        border-radius: 8px;
        transition: all 0.2s ease;
        position: relative;
    }
    
    .nav-user .user-info:hover,
    .nav-user .user-info:focus {
        background: rgba(255, 255, 255, 0.15);
        transform: translateX(8px);
    }
    
    .nav-user .user-info::after {
        content: '▼';
        font-size: 12px;
        transition: transform 0.2s ease;
    }
    
    .nav-user.active .user-info::after {
        transform: rotate(180deg);
    }
    
    .nav-user .dropdown {
        position: static;
        display: none;
        background: rgba(255, 255, 255, 0.05);
        box-shadow: none;
        border-radius: 0;
        padding: 0;
        min-width: auto;
        width: 100%;
    }
    
    .nav-user.active .dropdown {
        display: block;
    }
    
    .nav-user .dropdown::before {
        display: none;
    }
    
    .nav-user .dropdown li {
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }
    
    .nav-user .dropdown li:last-child {
        border-bottom: none;
    }
    
    .nav-user .dropdown a {
        padding: 14px 20px 14px 40px;
        color: rgba(255, 255, 255, 0.9);
        font-size: 15px;
        background: transparent;
        border-radius: 6px;
        margin: 2px 8px;
        transition: all 0.2s ease;
    }
    
    .nav-user .dropdown a:hover,
    .nav-user .dropdown a:focus {
        background: rgba(255, 255, 255, 0.1);
        color: var(--white);
        transform: translateX(4px);
    }
    
    /* Dashboard grid mobile */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    /* Family members section mobile */
    .family-members-section {
        padding: 20px;
        margin: 20px 0;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .section-header h2 {
        font-size: 1.3rem;
    }
    
    .family-members-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .family-member-card {
        padding: 10px;
    }
    
    .member-photo {
        width: 80px;
        height: 80px;
    }
    
    .member-photo-placeholder span {
        font-size: 2rem;
    }
    
    .member-info h4 {
        font-size: 0.9rem;
    }
    
    .member-info .member-role {
        font-size: 0.75rem;
    }
    
    /* Form adjustments for mobile */
    .form-inline {
        flex-direction: column;
    }
    
    .form-inline input,
    .form-inline select {
        width: 100%;
    }
    
    /* Container padding for mobile */
    .container {
        padding: 0 16px;
    }
    
    /* Header padding adjustment */
    .main-header {
        padding: 12px 0;
    }
    
    /* Site name responsive */
    .site-name {
        font-size: 1.2rem;
    }
    
    /* Touch target improvements */
    .dashboard-card {
        padding: 24px;
        min-height: 120px;
    }
    
    .card-icon {
        font-size: 2.5rem;
        margin-bottom: 12px;
    }
}

/* Tablet landscape adjustments */
@media (max-width: 1024px) and (min-width: 769px) {
    .nav-menu li {
        margin-left: 20px;
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .landing-header h1 {
        font-size: 1.8rem;
    }
    
    .site-name {
        font-size: 1rem;
    }
    
    .nav-menu {
        width: 100vw;
        right: -100vw;
    }
    
    .nav-menu.active {
        right: 0;
    }
    
    .container {
        padding: 0 12px;
    }
    
    .dashboard {
        padding: 20px 0;
    }
}

/* High DPI devices */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hamburger-line {
        height: 2px;
    }
}