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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background: #0f0f1a;
    color: #e0e0e0;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
}

header h1 {
    font-size: 2rem;
    color: #fff;
    margin-bottom: 0.5rem;
}

header p {
    color: #888;
    font-size: 1rem;
}

.btn-admin-toggle {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.3;
    transition: opacity 0.2s;
    padding: 0.5rem;
}

.btn-admin-toggle:hover {
    opacity: 0.7;
}

.admin-panel {
    margin-bottom: 1.5rem;
}

.admin-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 8px;
    padding: 0.6rem 1rem;
    color: #667eea;
    font-size: 0.85rem;
}

.btn-admin-logout {
    background: none;
    border: 1px solid rgba(102, 126, 234, 0.3);
    color: #667eea;
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s;
}

.btn-admin-logout:hover {
    background: rgba(102, 126, 234, 0.15);
}

.photo-card-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(239, 83, 80, 0.85);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.photo-card-delete:hover {
    background: rgba(239, 83, 80, 1);
    transform: scale(1.1);
}

.photo-card {
    position: relative;
}

.btn-delete-photo {
    margin-top: 0.75rem;
    background: rgba(239, 83, 80, 0.15);
    border: 1px solid rgba(239, 83, 80, 0.3);
    color: #ef5350;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-delete-photo:hover {
    background: rgba(239, 83, 80, 0.3);
}

.stats-bar {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat {
    text-align: center;
    padding: 1rem 2rem;
    background: #1a1a2e;
    border-radius: 12px;
    min-width: 140px;
}

.stat-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #00d4ff;
}

.stat-label {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.upload-section {
    margin-bottom: 2.5rem;
}

.upload-area {
    border: 2px dashed #2a2a4a;
    border-radius: 12px;
    padding: 2.5rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: #1a1a2e;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #00d4ff;
    background: #16213e;
}

.upload-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
}

.upload-text {
    color: #ccc;
    font-size: 1rem;
    margin-bottom: 0.35rem;
}

.upload-hint {
    color: #555;
    font-size: 0.8rem;
}

.upload-form {
    background: #1a1a2e;
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1rem;
}

.preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.preview-thumb {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid #2a2a4a;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 0.35rem;
}

.form-group input {
    width: 100%;
    padding: 0.85rem 1rem;
    border: 2px solid #2a2a4a;
    border-radius: 8px;
    background: #16213e;
    color: #fff;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: #00d4ff;
}

.form-group input::placeholder {
    color: #555;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.btn-upload {
    padding: 0.85rem 1.5rem;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
}

.btn-upload:hover {
    opacity: 0.9;
}

.btn-upload:active {
    transform: scale(0.97);
}

.btn-upload:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-cancel {
    padding: 0.85rem 1.5rem;
    background: #2a2a4a;
    color: #888;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel:hover {
    background: #3a3a5a;
    color: #ccc;
}

.form-message {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    min-height: 1.2em;
}

.form-message.error {
    color: #ef5350;
}

.form-message.success {
    color: #66bb6a;
}

.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.gallery-header h2 {
    font-size: 1.3rem;
    color: #fff;
}

.btn-refresh {
    background: #1a1a2e;
    border: 2px solid #2a2a4a;
    border-radius: 8px;
    color: #888;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.btn-refresh:hover {
    border-color: #00d4ff;
    color: #00d4ff;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: #555;
    font-size: 1rem;
}

.photo-card {
    background: #1a1a2e;
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.photo-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.photo-card-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    background: #16213e;
}

.photo-card-info {
    padding: 0.75rem 1rem;
}

.photo-card-author {
    font-weight: 600;
    font-size: 0.9rem;
    color: #fff;
    margin-bottom: 0.2rem;
}

.photo-card-desc {
    font-size: 0.8rem;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.photo-card-date {
    font-size: 0.7rem;
    color: #555;
    margin-top: 0.3rem;
}

/* Lightbox */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.lightbox.active {
    display: flex;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.lightbox-close {
    position: absolute;
    top: -48px;
    right: 0;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s;
}

.lightbox-close:hover {
    color: #ef5350;
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 1.5rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.25);
}

.lightbox-prev {
    left: -64px;
}

.lightbox-next {
    right: -64px;
}

.lightbox-content img {
    max-width: 90vw;
    max-height: 75vh;
    object-fit: contain;
    border-radius: 8px;
}

.lightbox-info {
    margin-top: 1rem;
    text-align: center;
}

.lightbox-author {
    display: block;
    font-weight: 600;
    color: #fff;
    font-size: 1rem;
}

.lightbox-desc {
    display: block;
    color: #888;
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Progress bar for upload */
.upload-progress {
    width: 100%;
    height: 4px;
    background: #2a2a4a;
    border-radius: 2px;
    margin-top: 0.5rem;
    overflow: hidden;
    display: none;
}

.upload-progress.active {
    display: block;
}

.upload-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 2px;
    transition: width 0.3s;
    width: 0%;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem 0.75rem;
    }
    header h1 {
        font-size: 1.5rem;
    }
    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 0.75rem;
    }
    .lightbox-prev {
        left: 4px;
    }
    .lightbox-next {
        right: 4px;
    }
    .lightbox-nav {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }
    .lightbox-close {
        top: -40px;
        right: -8px;
    }
    .stat {
        min-width: 100px;
        padding: 0.75rem 1rem;
    }
    .stat-value {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .photo-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    .photo-card-info {
        padding: 0.5rem 0.6rem;
    }
    .photo-card-author {
        font-size: 0.8rem;
    }
    .photo-card-desc {
        display: none;
    }
}
