@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
    --primary: #6366f1; /* Indigo */
    --primary-hover: #4f46e5;
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --text-main: #ffffff;
    --text-muted: #e2e8f0;
    --border: rgba(255, 255, 255, 0.1);
    --danger: #ef4444;
    --success: #10b981;
}

.btn {
    color: #ffffff !important;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-image: radial-gradient(circle at top right, rgba(99, 102, 241, 0.15), transparent 40%),
                      radial-gradient(circle at bottom left, rgba(16, 185, 129, 0.1), transparent 40%);
    background-attachment: fixed;
}

/* Glassmorphism utility */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

/* Typography */
h1, h2, h3 {
    font-weight: 600;
    margin-bottom: 1rem;
    letter-spacing: -0.5px;
}

.title-gradient {
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-size: 1rem;
    text-align: center;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.btn-danger {
    background: var(--danger);
    color: white;
}
.btn-danger:hover {
    background: #dc2626;
}
.btn-success {
    background: var(--success);
    color: white;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* Login specific */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 3rem 2rem;
    text-align: center;
}

/* Nav */
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border);
}

.nav-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.3s;
}
.nav-links a:hover {
    color: var(--text-main);
}

/* Grids & Cards */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.card {
    padding: 1.5rem;
    transition: transform 0.3s, box-shadow 0.3s;
    text-decoration: none;
    color: inherit;
    display: block;
}
.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

/* Photo Gallery */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.photo-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 1;
    cursor: pointer;
    background: #1e293b;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.photo-item:hover img {
    transform: scale(1.05);
}

.photo-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.photo-item:hover .photo-overlay {
    opacity: 1;
}

.check-icon {
    display: none;
}

.photo-item.selected .photo-overlay {
    opacity: 1;
    background: rgba(16, 185, 129, 0.3); /* Green tint */
    border: 3px solid var(--success);
}

.photo-item.selected .check-icon {
    display: flex;
    color: white;
    font-size: 1.5rem;
    background: var(--success);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 3rem;
    text-align: center;
    transition: all 0.3s ease;
    background: rgba(15, 23, 42, 0.3);
    margin-top: 1rem;
}
.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.progress-wrapper {
    margin-top: 1.5rem;
    display: none;
}
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--primary);
    width: 0%;
    transition: width 0.2s;
}
.progress-text {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Alert */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}
.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}
.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

/* Responsive Header & Sidebar */
.main-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    transition: all 0.3s ease;
    z-index: 100;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-nav {
    padding: 1rem;
    display: flex;
    flex-direction: column;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.8rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    transition: all 0.3s;
    white-space: nowrap;
}

.sidebar-link:hover, .sidebar-link.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--text-main);
}

.sidebar-link.active {
    background: var(--primary);
    color: white;
}

.content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.top-nav {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

/* Mobile Toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 1.5rem;
    cursor: pointer;
}
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        bottom: 0;
        box-shadow: 20px 0 50px rgba(0,0,0,0.5);
    }
    .sidebar.active {
        left: 0;
    }
    .menu-toggle {
        display: block;
    }
    .top-nav {
        padding: 0 1rem;
    }
    
    /* Overlay for mobile sidebar */
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        backdrop-filter: blur(4px);
        z-index: 99;
    }
    .sidebar-overlay.active {
        display: block;
    }

    /* Stack grids on mobile */
    .grid, .grid-2 {
        grid-template-columns: 1fr !important;
    }
    
    .grid-2 {
        gap: 1rem !important;
    }
    
    /* Stats cards spacing */
    .tab-content .grid {
        gap: 1rem;
    }
    
    /* Layout adjustments */
    .content-area {
        width: 100%;
        overflow-x: hidden;
    }
    
    .container {
        padding: 1.5rem 1rem;
    }

    /* Mobile Photo Grid 4-column Fix */
    .photo-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 5px !important;
    }
    .select-box {
        width: 16px;
        height: 16px;
        top: 3px;
        right: 3px;
        border-width: 1px !important;
    }
    .check-icon-box {
        font-size: 10px;
    }
    .status-label {
        font-size: 0.6rem !important;
        padding: 1px 4px !important;
        bottom: 5px !important;
        left: 5px !important;
    }

    /* Mobile Nav Fix */
    nav {
        flex-direction: column !important;
        gap: 0.8rem;
        padding: 1.2rem;
        height: auto;
        align-items: center !important;
        text-align: center;
    }
    .nav-brand {
        width: 100%;
        justify-content: center;
        margin-bottom: 5px;
    }
    .nav-links {
        width: 100%;
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        gap: 0.6rem;
    }
    .nav-links a:last-child {
        grid-column: span 2;
    }
    .nav-links .btn {
        padding: 0.5rem;
        font-size: 0.8rem;
        width: 100%;
        min-width: 0;
    }
    .nav-links span {
        display: none; /* Hide welcome message on mobile to save space */
    }
    .nav-brand img {
        max-height: 35px;
        width: auto;
    }
}

/* Admin Specific Full Width Override */
.admin-dashboard .container {
    max-width: 100%;
    padding: 2.5rem;
}

/* Sidebar close button - only visible on mobile active state */
.sidebar-close {
    display: none;
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

@media (max-width: 768px) {
    .sidebar-close {
        display: flex;
    }
}

/* Status Badges */
.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}
.status-active { background: rgba(16, 185, 129, 0.2); color: #10b981; }
.status-expired { background: rgba(239, 68, 68, 0.2); color: #ef4444; }

/* Dashboard Cards */
.stat-card {
    padding: 1.5rem;
    text-align: center;
}
.stat-value {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}
.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    backdrop-filter: blur(5px);
    align-items: center;
    justify-content: center;
}
.modal.active {
    display: flex;
}

.modal-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 40px;
    box-sizing: border-box;
}

.modal-content {
    max-width: 90%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 0 30px rgba(0,0,0,0.5);
    background: #1a1a1a;
}

.modal-actions {
    margin-top: 1.5rem;
}

.close-modal {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
    transition: 0.3s;
}
.close-modal:hover { color: #ccc; }

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    font-size: 30px;
    padding: 20px 15px;
    cursor: pointer;
    z-index: 1001;
    transition: 0.3s;
    border-radius: 8px;
}
.nav-btn:hover { background: rgba(255,255,255,0.2); }
.prev-btn { left: 20px; }
.next-btn { right: 20px; }

/* Photo Grid Selection Box */
.select-box {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    background: rgba(255,255,255,0.2);
    border: 2px solid white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 20;
    transition: all 0.3s ease;
    backdrop-filter: blur(4px);
}

.photo-item.selected .select-box {
    background: #ff4d4d;
    border-color: #ff4d4d;
}

.check-icon-box {
    color: white;
    font-weight: bold;
    font-size: 18px;
    opacity: 0;
    transition: opacity 0.2s;
}

.photo-item.selected .check-icon-box {
    opacity: 1;
}

@media (max-width: 768px) {
    .nav-btn {
        padding: 15px 10px;
        font-size: 20px;
    }
    .modal-wrapper {
        padding: 20px;
    }
    .prev-btn { left: 5px; }
    .next-btn { right: 5px; }
}
