/**
 * GeebrUp - ระบบเก็บหลักฐานภาพราชการ
 * Theme: Thai Government Dark Premium
 * Version: 3.0
 */

/* ===== CSS Variables ===== */
:root {
    /* Primary Colors - Royal Blue & Gold */
    --primary: #1e3a5f;
    --primary-light: #2d5a87;
    --primary-dark: #0f2440;
    --primary-gradient: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 50%, #1e3a5f 100%);
    
    /* Accent Colors - Thai Gold */
    --gold: #d4af37;
    --gold-light: #f4d03f;
    --gold-dark: #b8960c;
    --gold-gradient: linear-gradient(135deg, #d4af37 0%, #f4d03f 50%, #d4af37 100%);
    
    /* Status Colors */
    --success: #10b981;
    --success-light: #34d399;
    --danger: #ef4444;
    --danger-light: #f87171;
    --warning: #f59e0b;
    --info: #3b82f6;
    
    /* Background Colors */
    --bg-dark: #0a0f1a;
    --bg-body: #0f1629;
    --bg-card: #1a2332;
    --bg-card-hover: #212d40;
    --bg-input: #243447;
    --bg-elevated: #1e293b;
    
    /* Text Colors */
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    --text-gold: #d4af37;
    
    /* Border & Shadow */
    --border: #334155;
    --border-light: #475569;
    --border-gold: rgba(212, 175, 55, 0.3);
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.5);
    --shadow-gold: 0 4px 20px rgba(212, 175, 55, 0.2);
    --shadow-glow: 0 0 30px rgba(212, 175, 55, 0.15);
    
    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Font */
    --font-family: 'Sarabun', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-body);
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at top, rgba(212, 175, 55, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at bottom, rgba(30, 58, 95, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p { margin-bottom: 1rem; }

a {
    color: var(--gold);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--gold-light);
}

/* ===== Layout ===== */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

.main-content {
    padding: 1.5rem;
    max-width: 1280px;
    margin: 0 auto;
}

/* ===== Header ===== */
.header {
    background: var(--primary-gradient);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-lg);
    border-bottom: 2px solid var(--gold);
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gold-gradient);
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 1.5rem;
    max-width: 1280px;
    margin: 0 auto;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    text-decoration: none;
    color: var(--text-primary);
}

.logo-icon {
    position: relative;
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(212, 175, 55, 0.05));
    border: 2px solid var(--gold);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: var(--gold);
    box-shadow: var(--shadow-gold);
}

.logo-icon::after {
    content: '';
    position: absolute;
    inset: -4px;
    border: 1px solid rgba(212, 175, 55, 0.2);
    border-radius: var(--radius-lg);
}

.logo-text h1 {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.logo-text span {
    display: block;
    font-size: 0.75rem;
    color: var(--gold);
    font-weight: 500;
    letter-spacing: 1px;
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-base);
    text-decoration: none;
    white-space: nowrap;
}

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

/* Button Variants */
.btn-primary {
    background: var(--gold-gradient);
    color: var(--bg-dark);
    box-shadow: var(--shadow-gold);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(212, 175, 55, 0.35);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--gold);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), var(--success-light));
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.35);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), var(--danger-light));
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border-light);
    color: var(--text-secondary);
}

.btn-outline:hover {
    border-color: var(--gold);
    color: var(--gold);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* Button Sizes */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.875rem 2rem;
    font-size: 1.0625rem;
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--radius-md);
}

.btn-icon.sm {
    width: 36px;
    height: 36px;
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: var(--transition-base);
}

.card:hover {
    border-color: var(--border-light);
}

.card-premium {
    border-color: var(--border-gold);
    box-shadow: var(--shadow-glow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 1rem;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-title i {
    color: var(--gold);
    font-size: 1.25rem;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.1);
}

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

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-label.required::after {
    content: ' *';
    color: var(--danger);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    transition: var(--transition-base);
    -webkit-appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1.25rem;
    padding-right: 2.5rem;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.form-hint {
    margin-top: 0.375rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* ===== Upload Section ===== */
.upload-section {
    position: relative;
    background: linear-gradient(135deg, var(--bg-card), var(--bg-elevated));
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-xl);
    padding: 2.5rem 2rem;
    text-align: center;
    transition: var(--transition-base);
    overflow: hidden;
}

.upload-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(212, 175, 55, 0.05) 0%, transparent 70%);
    pointer-events: none;
}

.upload-section.dragover {
    border-color: var(--gold);
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), rgba(212, 175, 55, 0.05));
    box-shadow: var(--shadow-glow);
}

.upload-icon {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 1.25rem;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.15), rgba(212, 175, 55, 0.05));
    border: 2px solid var(--gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-icon i {
    font-size: 2.5rem;
    color: var(--gold);
}

.upload-section h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.upload-section p {
    color: var(--text-muted);
    font-size: 0.9375rem;
    margin-bottom: 1.5rem;
}

.upload-btn {
    background: var(--gold-gradient);
    color: var(--bg-dark);
    padding: 0.875rem 2rem;
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition-base);
    box-shadow: var(--shadow-gold);
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(212, 175, 55, 0.4);
}

.file-input {
    display: none;
}

/* Preview Grid */
.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-input);
    border: 2px solid var(--border);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item .remove-btn {
    position: absolute;
    top: 0.375rem;
    right: 0.375rem;
    width: 24px;
    height: 24px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: var(--transition-fast);
}

.preview-item .remove-btn:hover {
    background: var(--danger-light);
    transform: scale(1.1);
}

/* GPS Box */
.gps-box {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1rem;
    background: var(--bg-input);
    border-radius: var(--radius-md);
    margin-top: 1.25rem;
    border: 1px solid var(--border);
}

.gps-box i {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.gps-box.success i { color: var(--success); }
.gps-box.error i { color: var(--danger); }
.gps-box.loading i { 
    color: var(--warning); 
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.gps-info {
    flex: 1;
}

.gps-info strong {
    display: block;
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.gps-info small {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-top: 1.25rem;
    display: none;
}

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

.progress-fill {
    height: 100%;
    background: var(--gold-gradient);
    border-radius: var(--radius-full);
    width: 0%;
    transition: width 0.3s ease;
}

/* ===== Village Filter ===== */
.village-filter {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 0.5rem;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
}

.village-btn {
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-base);
}

.village-btn:hover {
    color: var(--text-secondary);
    background: var(--bg-input);
}

.village-btn.active {
    color: var(--gold);
    background: rgba(212, 175, 55, 0.1);
    border-color: var(--gold);
}

/* ===== Folder Grid ===== */
.folder-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

.folder-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: var(--transition-base);
    text-decoration: none;
    color: var(--text-primary);
}

.folder-item:hover {
    transform: translateY(-4px);
    border-color: var(--gold);
    box-shadow: var(--shadow-gold);
}

.folder-item .folder-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 0.875rem;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.15), rgba(212, 175, 55, 0.05));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.folder-item .folder-icon i {
    font-size: 2rem;
    color: var(--gold);
}

.folder-item.public .folder-icon {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.05));
}

.folder-item.public .folder-icon i {
    color: var(--success);
}

.folder-item .folder-name {
    font-weight: 600;
    font-size: 0.9375rem;
    text-align: center;
    margin-bottom: 0.25rem;
    word-break: break-word;
}

.folder-item .folder-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.folder-item .folder-badge {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
}

.folder-item .folder-badge.public {
    background: rgba(16, 185, 129, 0.2);
    color: var(--success);
}

.folder-item .folder-badge.village {
    background: rgba(59, 130, 246, 0.2);
    color: var(--info);
}

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

.photo-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-input);
    cursor: pointer;
    transition: var(--transition-base);
    border: 2px solid transparent;
}

.photo-item:hover {
    transform: scale(1.03);
    border-color: var(--gold);
    box-shadow: var(--shadow-gold);
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-base);
}

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

.photo-item .photo-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, transparent 50%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 0.875rem;
    opacity: 0;
    transition: var(--transition-base);
}

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

.photo-item .photo-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.photo-item .photo-badges {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    display: flex;
    gap: 0.25rem;
}

.badge {
    padding: 0.25rem 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.badge-pin {
    background: var(--warning);
    color: #000;
}

.badge-fav {
    background: var(--danger);
    color: white;
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-base);
}

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

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid var(--border-gold);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    transform: scale(0.9) translateY(20px);
    transition: var(--transition-base);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-title i {
    color: var(--gold);
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: var(--danger);
    color: white;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.1);
}

/* ===== Toast ===== */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    min-width: 280px;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.success i {
    color: var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.error i {
    color: var(--danger);
}

.toast i {
    font-size: 1.25rem;
}

.toast span {
    flex: 1;
    font-size: 0.9375rem;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== User Menu ===== */
.user-menu {
    position: relative;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: var(--transition-base);
}

.user-menu:hover .user-dropdown,
.user-dropdown:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

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

.dropdown-header strong {
    display: block;
    color: var(--text-primary);
}

.dropdown-header small {
    color: var(--text-muted);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition-fast);
}

.dropdown-item:hover {
    background: var(--bg-input);
    color: var(--gold);
}

.dropdown-item i {
    width: 20px;
    text-align: center;
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 0.5rem 0;
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 4rem;
    opacity: 0.3;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.9375rem;
}

/* ===== Loading ===== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Profile Header ===== */
.profile-header {
    background: var(--primary-gradient);
    border-radius: var(--radius-xl);
    padding: 2rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-gold);
    box-shadow: var(--shadow-glow);
    position: relative;
    overflow: hidden;
}

.profile-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gold-gradient);
}

.profile-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.profile-avatar {
    width: 90px;
    height: 90px;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(212, 175, 55, 0.1));
    border: 3px solid var(--gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--gold);
}

.profile-info h2 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.profile-info p {
    color: var(--gold);
    margin-bottom: 0;
    font-size: 0.9375rem;
}

.profile-stats {
    display: flex;
    gap: 2rem;
    margin-top: 1rem;
}

.stat {
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* ===== Auth States ===== */
.auth-only {
    display: none !important;
}

body.logged-in .auth-only {
    display: flex !important;
}

body.logged-in .guest-only {
    display: none !important;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .header-inner {
        padding: 0.75rem 1rem;
    }
    
    .logo-text span {
        display: none;
    }
    
    .logo-text h1 {
        font-size: 1.125rem;
    }
    
    .logo-icon {
        width: 44px;
        height: 44px;
        font-size: 1.5rem;
    }
    
    .main-content {
        padding: 1rem;
    }
    
    .photo-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .folder-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .profile-content {
        flex-direction: column;
        text-align: center;
    }
    
    .profile-stats {
        justify-content: center;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn .btn-text {
        display: none;
    }
    
    .village-filter {
        padding: 0.375rem;
    }
    
    .village-btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.8125rem;
    }
    
    .upload-section {
        padding: 1.5rem 1rem;
    }
    
    .upload-icon {
        width: 64px;
        height: 64px;
    }
    
    .upload-icon i {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .header-actions .btn:not(.btn-icon) .btn-text {
        display: none;
    }
    
    .photo-grid,
    .folder-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .modal {
        margin: 0.5rem;
        max-height: 95vh;
    }
    
    .modal-body {
        padding: 1rem;
    }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* ===== Selection ===== */
::selection {
    background: rgba(212, 175, 55, 0.3);
    color: var(--text-primary);
}

/* ===== Focus Visible ===== */
:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

/* ===== Print ===== */
@media print {
    .header,
    .upload-section,
    .village-filter,
    .btn {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .card {
        border: 1px solid #ccc;
        box-shadow: none;
    }
}
