/* ==========================================================
   Global Theme Variables
   ========================================================== */
:root {
    --primary-orange: #ff6b35;
    --primary-gold: #f7931e;
    --primary-yellow: #ffc107;
    --primary-blue: #4a90e2;
    --bg-overlay: rgba(255, 255, 255, 0.97);
    --text-color: #1a1a1a;
    --text-muted: #666;
    --border-color: #f0f0f0;
    --header-gradient: linear-gradient(135deg, #ff6b35 0%, #f7931e 50%, #ffc107 100%);
    --card-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

[data-theme="dark"] {
    --bg-overlay: rgba(30,30,30,0.95);
    --text-color: #e0e0e0;
    --text-muted: #a0a0a0;
    --border-color: #404040;
    --header-gradient: linear-gradient(135deg, #d45528 0%, #c67515 50%, #d4a005 100%);
    --card-shadow: 0 8px 32px rgba(0,0,0,0.6);
}

/* ==========================================================
   Base / Layout
   ========================================================== */
html, body {
    height: 100%;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text-color);
    transition: background 0.3s ease, color 0.3s ease;
}

body {
    background:
        linear-gradient(rgba(74, 144, 226, 0.3), rgba(255, 140, 66, 0.4)),
        url('/images/construction-bridge.jpg') center/cover no-repeat fixed,
        linear-gradient(to bottom, #4a90e2 0%, #5ba3f5 40%, #87ceeb 60%, #ffa566 85%, #ff8c42 100%);
    min-height: 100vh;
    position: relative;
}

[data-theme="dark"] body {
    background:
        linear-gradient(rgba(20,40,80,0.8), rgba(80,50,20,0.7)),
        url('/images/construction-bridge.jpg') center/cover no-repeat fixed,
        linear-gradient(to bottom, #1a2a3a 0%, #2a3a4a 40%, #3a4a5a 60%, #4a3a2a 85%, #3a2a1a 100%);
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 100px,
        rgba(255,255,255,0.03) 100px,
        rgba(255,255,255,0.03) 101px
    );
    pointer-events: none;
    z-index: 0;
}

/* ==========================================================
   Header
   ========================================================== */
.site-header {
    background: var(--header-gradient);
    color: #fff;
    padding: 20px 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    position: relative;
    z-index: 10;
}

.header-inner {
    max-width: 980px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.site-header h1 {
    margin: 0;
    font-size: 2rem;
    letter-spacing: 1px;
    background: var(--header-gradient);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    font-weight: 700;
    flex: 1;
    text-align: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    color: #fff;
}

.welcome-text {
    font-size: 0.95rem;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

.theme-toggle {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 2px solid rgba(255,255,255,0.5);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
}

.theme-toggle:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.8);
    transform: rotate(20deg);
}

.change-password-link {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 2px solid rgba(255,255,255,0.5);
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.2rem;
    text-decoration: none;
    display: inline-block;
}

.change-password-link:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.8);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.logout-btn {
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: 2px solid rgba(255,255,255,0.5);
    padding: 8px 20px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.logout-btn:hover {
    background: rgba(255,255,255,0.3);
    border-color: rgba(255,255,255,0.8);
    transform: translateY(-1px);
}

/* ==========================================================
   Main Container & Controls
   ========================================================== */
.container {
    max-width: 980px;
    margin: 28px auto;
    background: var(--bg-overlay);
    border-radius: 12px;
    padding: 24px;
    box-shadow: var(--card-shadow);
    position: relative;
    z-index: 5;
    border: 3px solid rgba(255,193,7,0.5);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(74,144,226,0.1) 0%, rgba(255,193,7,0.1) 100%);
    border-radius: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    padding: 4px 8px;
    border-radius: 4px;
}

.breadcrumb a:hover { background: rgba(74,144,226,0.2); }
.breadcrumb a:not(:last-child)::after { content: '›'; margin-left: 8px; color: var(--text-muted); }
.breadcrumb a.active { color: var(--primary-orange); font-weight: 600; }

.controls-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background: var(--bg-overlay);
    color: var(--text-color);
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(74,144,226,0.1);
}

.btn-upload {
    background: linear-gradient(135deg, var(--primary-blue) 0%, #5ba3f5 100%);
    color: #fff;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(74,144,226,0.3);
    white-space: nowrap;
}

.btn-upload:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(74,144,226,0.5); }

/* ==========================================================
   Files / Folders Lists
   ========================================================== */
.files h2 {
    margin-top: 0;
    color: var(--primary-orange);
    font-size: 1.5rem;
    border-bottom: 3px solid var(--primary-yellow);
    padding-bottom: 8px;
    margin-bottom: 16px;
}

.folder-list { list-style: none; padding: 0; margin: 8px 0 16px; }
.folder-list li {
    padding: 12px 16px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #4a90e2 0%, #5ba3f5 100%);
    border-radius: 8px;
    transition: all 0.3s ease;
}
.folder-list li:hover { transform: translateX(5px); box-shadow: 0 4px 12px rgba(74,144,226,0.4); }
.folder-list li a { color: #fff; text-decoration: none; display: block; font-weight: 500; font-size: 1.05rem; }

.file-list { list-style: none; padding: 0; margin: 8px 0 0; }
.file-list li {
    padding: 12px 16px;
    border-bottom: 2px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s ease;
}
.file-list li:hover { background: linear-gradient(90deg, rgba(255,193,7,0.1) 0%, rgba(255,107,53,0.1) 100%); }
.file-list li span:first-child { color: #333; font-weight: 500; font-size: 1.05rem; }

.btn-edit {
    background: linear-gradient(135deg, var(--primary-orange) 0%, var(--primary-gold) 100%);
    color: #fff !important;
    padding: 8px 20px;
    border-radius: 6px;
    text-decoration: none !important;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255,107,53,0.3);
    display: inline-block !important;
}
.btn-edit:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(255,107,53,0.5); background: linear-gradient(135deg, var(--primary-gold) 0%, var(--primary-orange) 100%); }

.muted { color: var(--text-muted); text-align: center; padding: 20px; font-style: italic; }
.error {
    color: #d32f2f;
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    padding: 12px 16px;
    border-radius: 8px;
    border-left: 4px solid #d32f2f;
    margin-bottom: 16px;
}

/* ==========================================================
   Back Navigation
   ========================================================== */
.header-with-back { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.back-btn {
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    border-radius: 6px;
    background: rgba(74,144,226,0.1);
    transition: all 0.3s ease;
    border: 2px solid rgba(74,144,226,0.3);
    width: fit-content;
}
.back-btn:hover { background: rgba(74,144,226,0.2); border-color: rgba(74,144,226,0.5); transform: translateX(-3px); color: #3a7cbd; }

/* ==========================================================
   Password Change Form
   ========================================================== */
.password-change-form {
    max-width: 500px;
    margin: 24px auto;
    padding: 24px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    background: var(--bg-primary);
    color: var(--text-primary);
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-blue);
}

.form-hint {
    display: block;
    margin-top: 4px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.btn-submit {
    flex: 1;
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--primary-blue) 0%, rgba(74,144,226,0.8) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74,144,226,0.4);
}

.btn-cancel {
    flex: 1;
    padding: 12px 24px;
    background: var(--border-color);
    color: var(--text-primary);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
}

.btn-cancel:hover {
    background: var(--text-muted);
    color: white;
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-success {
    background: rgba(76,175,80,0.1);
    color: #2e7d32;
    border: 2px solid rgba(76,175,80,0.3);
}

.alert-error {
    background: rgba(244,67,54,0.1);
    color: #c62828;
    border: 2px solid rgba(244,67,54,0.3);
}

[data-theme="dark"] .alert-success {
    background: rgba(76,175,80,0.2);
    color: #81c784;
}

[data-theme="dark"] .alert-error {
    background: rgba(244,67,54,0.2);
    color: #e57373;
}

/* ==========================================================
   Responsive
   ========================================================== */
@media (max-width: 600px) {
    .header-inner { padding: 0 12px; }
    .site-header h1 { font-size: 1.3rem; }
    .container { margin: 16px; padding: 16px; }
    .controls-bar { flex-direction: column; }
}

