/* ============================================
   Espace Client - Styles Premium
   Theme: Midnight Gala Luxe (Noir + Or)
   ============================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700&family=Manrope:wght@300;400;500;600;700&display=swap');

/* CSS Variables */
:root {
    /* Backgrounds */
    --bg-main: #050505;
    --bg-card: #0A0A0A;
    --bg-sidebar: #080808;
    --bg-input: #121212;
    
    /* Primary Gold */
    --gold: #D4AF37;
    --gold-hover: #B5952F;
    --gold-dim: rgba(212, 175, 55, 0.1);
    --gold-gradient: linear-gradient(135deg, #D4AF37 0%, #F5D97A 100%);
    
    /* Text */
    --text-primary: #F5F5F5;
    --text-secondary: #A3A3A3;
    --text-muted: #525252;
    --text-inverse: #000000;
    
    /* Borders */
    --border-subtle: #262626;
    --border-accent: rgba(212, 175, 55, 0.3);
    
    /* Status */
    --success: #10B981;
    --error: #EF4444;
    --warning: #F59E0B;
    --info: #3B82F6;
    
    /* Shadows */
    --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.5);
    --shadow-gold: 0 0 15px rgba(212, 175, 55, 0.3);
    
    /* Spacing */
    --sidebar-width: 280px;
}

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

/* Base */
html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Manrope', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Playfair Display', serif;
    font-weight: 500;
    letter-spacing: -0.02em;
}

a {
    color: var(--gold);
    text-decoration: none;
    transition: color 0.3s ease;
}

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

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-main);
    position: relative;
    padding: 2rem;
}

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

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 3rem;
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
    box-shadow: var(--shadow-card);
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo img {
    max-width: 180px;
    height: auto;
}

.login-logo h1 {
    font-size: 1.75rem;
    color: var(--gold);
    margin-top: 1rem;
}

.login-title {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.login-subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

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

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

.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: 'Manrope', sans-serif;
    transition: all 0.3s ease;
}

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

.form-input:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-dim);
}

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

textarea.form-input {
    min-height: 120px;
    resize: vertical;
}

select.form-input {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23A3A3A3' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 2.5rem;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: 'Manrope', sans-serif;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--gold-gradient);
    color: var(--text-inverse);
    box-shadow: var(--shadow-gold);
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-accent);
    color: var(--gold);
}

.btn-secondary:hover {
    background: var(--gold-dim);
}

.btn-danger {
    background: var(--error);
    color: white;
}

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

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

.btn-ghost:hover {
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

.btn-block {
    width: 100%;
}

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

/* ============================================
   LAYOUT - SIDEBAR
   ============================================ */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform 0.3s ease;
}

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

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo img {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
}

.sidebar-logo-text {
    font-family: 'Playfair Display', serif;
    font-size: 1.25rem;
    color: var(--gold);
    font-weight: 500;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    padding: 0.5rem 1.5rem;
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    color: var(--gold);
    background: var(--gold-dim);
    border-left-color: var(--gold);
}

.nav-link.active {
    color: var(--gold);
    background: var(--gold-dim);
    border-left-color: var(--gold);
}

.nav-link i {
    font-size: 1.125rem;
    width: 24px;
    text-align: center;
}

.nav-badge {
    margin-left: auto;
    background: var(--gold);
    color: var(--text-inverse);
    font-size: 0.6875rem;
    font-weight: 700;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-subtle);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--gold-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gold);
    font-weight: 600;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================
   MAIN CONTENT WRAPPER
   ============================================ */
.main-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main-content {
    flex: 1;
    padding: 2rem;
}

.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--text-secondary);
    font-size: 0.9375rem;
}

.page-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 1.5rem;
    transition: border-color 0.3s ease;
}

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

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

.card-title {
    font-size: 1.125rem;
    font-weight: 500;
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: var(--gold-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gold);
    font-size: 1.25rem;
}

.card-value {
    font-size: 2rem;
    font-weight: 700;
    font-family: 'Playfair Display', serif;
    color: var(--gold);
}

.card-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    overflow: hidden;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 1rem 1.25rem;
    text-align: left;
}

.table th {
    background: rgba(255, 255, 255, 0.02);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    font-weight: 600;
}

.table td {
    border-top: 1px solid var(--border-subtle);
    font-size: 0.9375rem;
}

.table tr:hover td {
    background: rgba(212, 175, 55, 0.02);
}

.table-actions {
    display: flex;
    gap: 0.5rem;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.badge-error {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.badge-info {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
}

.badge-gold {
    background: var(--gold-dim);
    color: var(--gold);
}

/* ============================================
   ALERTS
   ============================================ */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--error);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--warning);
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--info);
}

/* ============================================
   DOCUMENTS LIST
   ============================================ */
.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.document-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 1.25rem;
    transition: all 0.3s ease;
}

.document-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-2px);
}

.document-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.document-icon.pdf {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.document-icon.image {
    background: rgba(59, 130, 246, 0.15);
    color: var(--info);
}

.document-name {
    font-weight: 600;
    margin-bottom: 0.25rem;
    word-break: break-word;
}

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

.document-actions {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    gap: 0.5rem;
}

/* ============================================
   MESSAGES
   ============================================ */
.messages-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 1.25rem;
    transition: all 0.3s ease;
}

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

.message-card.unread {
    border-left: 3px solid var(--gold);
}

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

.message-sender {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gold-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gold);
    font-weight: 600;
    font-size: 0.875rem;
}

.message-sender-name {
    font-weight: 600;
}

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

.message-subject {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--gold);
}

.message-preview {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.5;
}

.message-content {
    background: var(--bg-input);
    border-radius: 4px;
    padding: 1rem;
    margin-top: 1rem;
    white-space: pre-wrap;
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 2rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

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

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

.modal-title {
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
}

.empty-state-icon {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.empty-state-text {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* ============================================
   FOOTER
   ============================================ */
.app-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-card);
    margin-top: auto;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.footer-brand {
    font-family: 'Playfair Display', serif;
    color: var(--gold);
    font-size: 0.9375rem;
    font-weight: 500;
}

.footer-separator {
    color: var(--text-muted);
}

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

.footer-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.footer-version {
    color: var(--text-muted);
    font-size: 0.75rem;
    background: var(--bg-input);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

/* ============================================
   UTILITIES
   ============================================ */
.text-gold { color: var(--gold); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }

.hidden { display: none; }

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-wrapper {
        margin-left: 0;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 1rem;
    }
    
    .app-footer {
        padding: 1rem;
    }
    
    .footer-content {
        justify-content: center;
        text-align: center;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .table-container {
        overflow-x: auto;
    }
    
    .table {
        min-width: 600px;
    }
    
    .login-card {
        padding: 2rem;
    }
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 101;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 0.75rem;
    border-radius: 4px;
    cursor: pointer;
}

@media (max-width: 1024px) {
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

@media (max-width: 1024px) {
    .sidebar-overlay.active {
        display: block;
    }
}

/* ============================================
   CUSTOM LINKS SECTION
   ============================================ */
.links-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.link-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border-radius: 4px;
    color: var(--gold);
    transition: all 0.3s ease;
}

.link-item:hover {
    background: var(--gold-dim);
}

.link-item i {
    font-size: 1rem;
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease forwards;
}

/* Stagger animations */
.animate-stagger > * {
    opacity: 0;
    animation: fadeIn 0.3s ease forwards;
}

.animate-stagger > *:nth-child(1) { animation-delay: 0.05s; }
.animate-stagger > *:nth-child(2) { animation-delay: 0.1s; }
.animate-stagger > *:nth-child(3) { animation-delay: 0.15s; }
.animate-stagger > *:nth-child(4) { animation-delay: 0.2s; }
.animate-stagger > *:nth-child(5) { animation-delay: 0.25s; }
