* {
    box-sizing: border-box;
}

:root {
    /* New Vibrant Green Palette */
    --primary-green: #059669;
    /* Emerald 600 */
    --primary-dark: #047857;
    /* Emerald 700 */
    --primary-light: #34d399;
    /* Emerald 400 */
    --accent-bg: #ecfdf5;
    /* Emerald 50 */
    --surface: #ffffff;
    --text-main: #1f2937;
    /* Gray 800 */
    --text-muted: #6b7280;
    /* Gray 500 */
    --danger: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: #f3f4f6;
    color: var(--text-main);
    overflow-x: hidden;
}

/* TOPBAR */
.topbar {
    background: var(--surface);
    padding: 16px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 50;
    border-bottom: 1px solid #e5e7eb;
}

.topbar h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-dark);
    letter-spacing: -0.025em;
}

.back-btn {
    text-decoration: none;
    color: var(--text-muted);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    transition: all 0.2s;
    padding: 8px 12px;
    border-radius: 8px;
}

.back-btn:hover {
    color: var(--primary-dark);
    background: var(--accent-bg);
}

/* UPLOAD SECTION */
.upload-container {
    max-width: 1400px;
    margin: 24px auto;
    padding: 0 24px;
}

.upload-box {
    background: var(--surface);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 2px dashed #d1d5db;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.upload-box:hover {
    border-color: var(--primary-light);
    background: var(--accent-bg);
}

.controls {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.custom-file-upload {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-main);
    transition: 0.2s;
    box-shadow: var(--shadow-sm);
}

.custom-file-upload:hover {
    border-color: var(--primary-green);
    color: var(--primary-green);
}

.btn-upload {
    padding: 10px 24px;
    background: var(--primary-green);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    transition: 0.2s;
}

.btn-upload:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.file-info {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* GALLERY GRID */
.gallery {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 24px;
    padding: 0 24px 40px 24px;
    max-width: 1400px;
    margin: 0 auto;
}

@media (max-width: 1280px) {
    .gallery {
        grid-template-columns: repeat(5, 1fr);
    }
}

@media (max-width: 1024px) {
    .gallery {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 768px) {
    .gallery {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 640px) {
    .gallery {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 420px) {
    .gallery {
        grid-template-columns: 1fr;
    }
}

.img-card {
    background: var(--surface);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border: 1px solid #e5e7eb;
}

.img-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-light);
}

.img-card .img-container {
    height: 180px;
    /* Fixed height for consistency */
    width: 100%;
    overflow: hidden;
    background: #f9fafb;
    position: relative;
    cursor: zoom-in;
}

.img-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.img-card:hover img {
    transform: scale(1.08);
    /* Gentle zoom effect */
}

/* ACTIONS */
.actions {
    padding: 12px;
    display: flex;
    gap: 8px;
    background: var(--surface);
    border-top: 1px solid #f3f4f6;
}

.actions a {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px;
    border-radius: 6px;
    transition: 0.2s;
    color: var(--text-muted);
    background: #f9fafb;
}

.actions .download:hover {
    background: var(--accent-bg);
    color: var(--primary-dark);
}

.actions .delete:hover {
    background: #fef2f2;
    color: var(--danger);
}

/* MODAL / LIGHTBOX */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    display: flex;
    opacity: 1;
}

.modal img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    /* Ensures functionality of "seeing it big" */
    border-radius: 4px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.8);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal.show img {
    transform: scale(1);
}

.close {
    position: absolute;
    top: 20px;
    right: 30px;
    font-size: 40px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    z-index: 1001;
    line-height: 1;
    transition: 0.2s;
}

.close:hover {
    color: white;
    transform: scale(1.1);
}

/* DASHBOARD & LOGIN */
.login-body {
    background: radial-gradient(circle at top right, #059669, #064e3b),
        radial-gradient(circle at bottom left, #34d399, #065f46);
    background-size: cover;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

/* Glassmorphism Background Circles */
.login-body::before,
.login-body::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    z-index: 1;
}

.login-body::before {
    width: 600px;
    height: 600px;
    background: rgba(52, 211, 153, 0.2);
    top: -100px;
    right: -100px;
    filter: blur(80px);
}

.login-body::after {
    width: 500px;
    height: 500px;
    background: rgba(6, 78, 59, 0.3);
    bottom: -50px;
    left: -50px;
    filter: blur(80px);
}

.login-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 48px;
    border-radius: 24px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    text-align: center;
    position: relative;
    z-index: 10;
    border: 1px solid rgba(255, 255, 255, 0.5);
    animation: slideUp 0.6s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    margin-bottom: 32px;
}

.login-icon {
    width: 64px;
    height: 64px;
    background: rgba(5, 150, 105, 0.1);
    color: var(--primary-green);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.login-card h2 {
    margin: 0;
    color: var(--text-main);
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.login-card p {
    color: var(--text-muted);
    margin-top: 8px;
    font-size: 0.95rem;
}

.input-group {
    position: relative;
    margin-bottom: 20px;
    text-align: left;
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    padding-left: 44px;
    /* Icon space */
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.2s;
    outline: none;
    background: rgba(255, 255, 255, 0.8);
}

.input-group input:focus {
    border-color: var(--primary-green);
    background: white;
    box-shadow: 0 0 0 4px rgba(5, 150, 105, 0.1);
}

.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
    transition: 0.2s;
}

.input-group input:focus+.input-icon {
    color: var(--primary-green);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary-green), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin-top: 10px;
    box-shadow: 0 4px 6px -1px rgba(5, 150, 105, 0.2);
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(5, 150, 105, 0.3);
}

.btn-login:active {
    transform: translateY(0);
}

.forgot-link {
    display: inline-block;
    margin-top: 24px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: 0.2s;
}

.forgot-link:hover {
    color: var(--primary-green);
    text-decoration: underline;
}

/* Dashboard Cards */
.card-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
    padding: 48px;
    max-width: 1200px;
    margin: 0 auto;
}

.card {
    padding: 48px;
    background: var(--surface);
    border-radius: 20px;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--text-main);
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.card:hover {
    transform: translateY(-8px);
    border-color: var(--primary-light);
    box-shadow: var(--shadow-lg);
    background: var(--accent-bg);
}

.card svg {
    width: 64px;
    height: 64px;
    color: var(--primary-green);
    margin-bottom: 8px;
    transition: 0.3s;
}

.card:hover svg {
    color: var(--primary-dark);
    transform: scale(1.1);
}

.error {
    background: #fef2f2;
    color: var(--danger);
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 24px;
    font-size: 0.9rem;
    border: 1px solid #fee2e2;
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
}

.error svg {
    flex-shrink: 0;
}