* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #000000;
    --primary-dark: #1a1a1a;
    --secondary: #8B8B8B;
    --success: #30D158;
    --danger: #FF453A;
    --duly-green:#0e9d9c;
    --warning: #FF9F0A;
    --background: #FFFFFF;
    --surface: #F5F5F7;
    --text: #000000;
    --text-light: #6E6E73;
    --text-lighter: #86868B;
    --border: #D2D2D7;
    --border-light: #E8E8ED;
    --radius: 12px;
    --radius-lg: 18px;
    --shadow: 0 1px 3px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 25px rgba(0,0,0,0.05);
    --header-height: 60px;
    --max-width: 1200px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.47059;
    font-weight: 400;
    letter-spacing: -0.022em;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
}

/* Header & Navigation */
header {
    background: var(--surface);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    position: relative;
}

/* Logo - Larger Size */
.logo {
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
}

.logo-image {
    width: 90px;
    height: 90px;
    object-fit: contain;
    transition: transform 0.2s ease;
}

.logo:hover .logo-image {
    transform: scale(1.05);
}

.logo-text {
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* Navigation Links */
.nav-links {
    display: flex;
    gap: 2.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
    align-items: center;
}

.nav-links a {
    color: var(--text-light);
    text-decoration: none;
    font-weight: 500;
    font-size: 1.1rem;
    transition: color 0.2s;
    padding: 0.5rem 0;
    position: relative;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--primary);
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    width: 28px;
    height: 28px;
    cursor: pointer;
    padding: 0;
    position: relative;
    z-index: 1001;
}

.menu-toggle span {
    display: block;
    width: 100%;
    height: 3px;
    background: var(--text);
    transition: all 0.3s ease;
    transform-origin: center;
    border-radius: 2px;
}

.menu-toggle span:nth-child(1) {
    transform: translateY(-5px);
}

.menu-toggle span:nth-child(3) {
    transform: translateY(5px);
}

.menu-toggle.active span:nth-child(1) {
    transform: translateY(1px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
    transform: scale(0);
}

.menu-toggle.active span:nth-child(3) {
    transform: translateY(-1px) rotate(-45deg);
}

/* Mobile Overlay */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}


/* Prevent nav from expanding when logo grows */
nav {
    height: var(--header-height);
    min-height: var(--header-height);
}

/* Logo stays fixed size inside nav */
.logo-wrap {
    height: var(--header-height);
    display: flex;
    align-items: center;
}

.logo {
    flex: 0 0 auto;
}

.menu-toggle {
    flex: 0 0 auto;
}

/* Force left + right alignment on mobile */
@media (max-width: 768px) {
    nav {
        justify-content: space-between;
    }

    .logo {
        margin-right: auto;
    }

    .menu-toggle {
        margin-left: auto;
    }
}
@media (max-width: 768px) {
    nav {
        display: flex;
        align-items: center;
        flex-direction: row;
        justify-content: space-between;
    }

    .menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        width: 32px;
        height: auto;     /* <-- IMPORTANT: no fixed height */
        padding: 0;
        margin-left: auto;
    }

    .logo,
    .logo-wrap {
        display: flex;
        align-items: center;
    }
}

/* Main Content */
main {
    min-height: 100vh;
    padding-top: var(--header-height);
}

/* Hero Section */
.hero {
    padding: 120px 0 80px;
    text-align: center;
    background: linear-gradient(135deg, var(--background) 0%, var(--surface) 100%);
}

.hero h1 {
    font-size: 48px;
    font-weight: 600;
    line-height: 1.08349;
    letter-spacing: -0.003em;
    margin-bottom: 24px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.hero p {
    font-size: 21px;
    color: var(--text-light);
    line-height: 1.381;
    max-width: 600px;
    margin: 0 auto 40px;
}

/* Cards - Apple Style */
.card {
    background: var(--background);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    overflow: hidden;
    transition: all 0.3s ease;
}


.card-header {
    padding: 32px 32px 0;
    margin-bottom: 24px;
}

.card-title {
    font-size: 28px;
    font-weight: 600;
    line-height: 1.14286;
    letter-spacing: -0.004em;
    margin-bottom: 8px;
}

.card-content {
    padding: 0 32px 32px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 32px 0;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 32px 24px;
    text-align: center;
    border: 1px solid var(--border-light);
}

.stat-value {
    font-size: 48px;
    font-weight: 600;
    line-height: 1;
    margin-bottom: 8px;
    color: var(--text);
}

.stat-label {
    font-size: 17px;
    color: var(--text-light);
    font-weight: 400;
}

/* Buttons - Apple Style */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border: none;
    border-radius: 980px;
    font-size: 17px;
    font-weight: 400;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--primary);
    color: white;
    min-height: 44px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: scale(1.02);
}

.btn-secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--surface);
}

.btn-success {
    background: var(--success);
    color: white;
}

/* Forms */
.form-group {
    margin-bottom: 24px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-size: 17px;
    font-weight: 400;
    color: var(--text);
}

input, select, textarea {
    width: 100%;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 17px;
    background: var(--background);
    transition: all 0.2s ease;
    font-family: inherit;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.1);
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-light);
    font-size: 17px;
}

th {
    background: var(--surface);
    font-weight: 600;
    color: var(--text);
}

tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 15px;
    font-weight: 500;
    line-height: 1;
}

.badge-success { background: #30D158; color: white; }
.badge-warning { background: #FF9F0A; color: white; }
.badge-danger { background: #FF453A; color: white; }
.badge-info { background: var(--surface); color: var(--text); border: 1px solid var(--border); }

/* Grid System */
.grid {
    display: grid;
    gap: 24px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* Alerts */
.alert {
    padding: 20px 24px;
    border-radius: var(--radius);
    margin-bottom: 24px;
    border: 1px solid;
    font-size: 17px;
}

.alert-success {
    background: rgba(48, 209, 88, 0.1);
    border-color: var(--success);
    color: var(--success);
}

.alert-danger {
    background: rgba(255, 69, 58, 0.1);
    border-color: var(--danger);
    color: var(--danger);
}

/* Footer */
.footer {
    background: var(--surface);
    border-top: 1px solid var(--border-light);
    padding: 40px 0;
    margin-top: 80px;
}

.footer-content {
    text-align: center;
    color: var(--text-light);
}

/* PJAX Loading Bar */
.pjax-loading-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), #333, #666);
    transform: translateX(-100%);
    z-index: 1002;
    pointer-events: none;
}

.pjax-loading-bar.loading {
    animation: loadingBar 1.5s ease-in-out infinite;
}

@keyframes loadingBar {
    0% {
        transform: translateX(-100%);
    }
    50% {
        transform: translateX(0%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 20px;
    }
    
    nav {
        padding: 1rem 0;
    }
    
    .logo {
        gap: 12px;
    }
    
    .logo-image {
        width: 40px;
        height: 40px;
    }
    
    .logo-text {
        font-size: 1.2rem;
    }
    
    .menu-toggle {
        display: flex;
        width: 32px;
        height: 32px;
    }
    
    .menu-toggle span {
        height: 3px;
    }
    
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 320px;
        height: 100vh;
        background: var(--surface);
        flex-direction: column;
        gap: 0;
        padding: 100px 32px 32px;
        transition: right 0.3s ease;
        z-index: 999;
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.1);
    }
    
    .nav-links.active {
        right: 0;
    }
    
    .nav-links li {
        width: 100%;
    }
    
    .nav-links a {
        display: block;
        padding: 1.25rem 1.5rem;
        border-radius: var(--radius);
        transition: all 0.2s ease;
        color: var(--text);
        font-size: 1.2rem;
        font-weight: 500;
    }
    
    .nav-links a:hover,
    .nav-links a.active {
        background: var(--background);
        color: var(--primary);
        transform: translateX(8px);
    }
    
    .nav-links a.active::after {
        display: none;
    }
    
    .nav-links a[data-no-pjax] {
        color: var(--danger);
        margin-top: 1rem;
        border-top: 1px solid var(--border-light);
        padding-top: 1.5rem;
    }
    
    .nav-links a[data-no-pjax]:hover {
        background: rgba(239, 68, 68, 0.1);
    }
    
    .hero h1 {
        font-size: 40px;
    }
    
    .hero p {
        font-size: 19px;
    }
    
    .grid-2,
    .grid-3 {
        grid-template-columns: 1fr;
    }
    
    .card-header {
        padding: 24px 24px 0;
    }
    
    .card-content {
        padding: 0 24px 24px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }
    
    .logo {
        gap: 10px;
    }
    
    .logo-image {
        width: 36px;
        height: 36px;
    }
    
    .logo-text {
        font-size: 1.1rem;
    }
    
    .nav-links {
        width: 100%;
        right: -100%;
        padding: 90px 24px 24px;
    }
    
    .nav-links.active {
        right: 0;
    }
    
    .nav-links a {
        font-size: 1.1rem;
        padding: 1rem 1.25rem;
    }
    
    .hero h1 {
        font-size: 32px;
    }
    
    .hero p {
        font-size: 17px;
    }
    
    .stat-value {
        font-size: 40px;
    }
}

/* Large screens */
@media (min-width: 1440px) {
    .logo-image {
        width: 52px;
        height: 52px;
    }
    
    .logo-text {
        font-size: 1.5rem;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .nav-links,
    .menu-toggle span,
    .mobile-overlay,
    .logo-image,
    .card,
    .btn {
        transition: none;
    }
    
    .pjax-loading-bar.loading {
        animation: none;
    }
}

/* High contrast support */
@media (prefers-contrast: high) {
    .nav-links a {
        border: 1px solid transparent;
    }
    
    .nav-links a.active {
        border-color: var(--primary);
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .mobile-overlay {
        background: rgba(0, 0, 0, 0.7);
    }
}


#pjax-container {
    transition: opacity 0.2s ease;
}

#pjax-container.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Ensure PJAX pages start at top */
/* Add this to your CSS */
html {
    scroll-behavior: smooth;
}

/* Force initial scroll position */
body::before {
    content: '';
    display: block;
    height: 0;
    width: 0;
}

/* Force scroll to top for form submissions */
form[data-pjax-form] {
    scroll-margin-top: 0;
}
/* Utility Classes */
.text-center { text-align: center; }
.text-light { color: var(--text-light); }
.mb-4 { margin-bottom: 24px; }
.mt-4 { margin-top: 24px; }
.p-4 { padding: 24px; }