/* =============================================
   STYLES COMPLETS - VERSION AMÉLIORÉE
   CollabFiles - Premium UX/UI
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #f0f2f8;
    color: #1a202c;
}

/* ===== AUTH PAGES ===== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.auth-box {
    background: white;
    border-radius: 20px;
    padding: 44px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.25);
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to   { opacity: 1; transform: translateY(0); }
}

.auth-box h1 {
    text-align: center;
    margin-bottom: 8px;
    color: #1a202c;
    font-size: 1.8rem;
    font-weight: 700;
}

.subtitle {
    text-align: center;
    color: #718096;
    margin-bottom: 32px;
    font-size: 0.95rem;
}

.auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 28px;
    background: #f0f2f5;
    border-radius: 10px;
    padding: 4px;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #718096;
    transition: all 0.25s;
}

.tab-btn.active {
    background: white;
    color: #667eea;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.auth-form input {
    width: 100%;
    padding: 13px 16px;
    margin-bottom: 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.auth-form input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

.auth-form button {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
}

.auth-form button:hover { opacity: 0.9; transform: translateY(-1px); }
.auth-form button:active { transform: translateY(0); }

.hidden { display: none !important; }

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

.sidebar {
    width: 270px;
    background: white;
    border-right: 1px solid #e8eaf0;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    left: 0;
    top: 0;
    box-shadow: 2px 0 12px rgba(0,0,0,0.04);
    z-index: 100;
}

.logo {
    padding: 24px 22px;
    border-bottom: 1px solid #f0f2f5;
}

.logo h2 {
    color: #667eea;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    margin-bottom: 4px;
    color: #4a5568;
    text-decoration: none;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.nav-item:hover { background: #f0f2f8; color: #667eea; }
.nav-item.active { background: linear-gradient(135deg, #f0f2ff, #f5f0ff); color: #667eea; font-weight: 600; }

.user-info {
    padding: 16px 18px;
    border-top: 1px solid #f0f2f5;
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.user-details { flex: 1; min-width: 0; }
.user-details strong { display: block; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-details small { color: #a0aec0; font-size: 0.78rem; }

.logout {
    text-decoration: none;
    font-size: 18px;
    opacity: 0.5;
    transition: opacity 0.2s;
    padding: 4px;
    border-radius: 6px;
}
.logout:hover { opacity: 1; }

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    margin-left: 270px;
    padding: 28px;
    min-height: 100vh;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.top-bar h1 {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1a202c;
}

/* ===== BUTTONS ===== */
.btn-primary {
    padding: 10px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    transition: opacity 0.2s, transform 0.1s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.35);
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(102,126,234,0.4); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-secondary {
    padding: 10px 20px;
    background: white;
    color: #667eea;
    border: 1.5px solid #667eea;
    border-radius: 9px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    transition: all 0.2s;
}
.btn-secondary:hover { background: #f0f2ff; }
.btn-secondary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-danger-solid {
    padding: 10px 20px;
    background: #e53e3e;
    color: white;
    border: none;
    border-radius: 9px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    transition: background 0.2s;
}
.btn-danger-solid:hover { background: #c53030; }

/* ===== FILE TABS ===== */
.files-tabs {
    display: flex;
    gap: 4px;
    background: #edf0f7;
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 18px;
    width: fit-content;
}

.files-tab {
    padding: 8px 20px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: #718096;
    font-size: 0.88rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.files-tab.active {
    background: white;
    color: #667eea;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* ===== SEARCH ===== */
.search-bar {
    position: relative;
    margin-bottom: 18px;
}

.search-bar input {
    width: 100%;
    padding: 12px 18px 12px 44px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 0.93rem;
    font-family: inherit;
    background: white;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-bar::before {
    content: '🔍';
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    z-index: 1;
}

.search-bar input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.12);
}

.search-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: white;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 200;
    box-shadow: 0 8px 25px rgba(0,0,0,0.12);
}

.search-result-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f5f5f5;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.15s;
}
.search-result-item:hover { background: #f7f8fc; }
.search-result-item:last-child { border-bottom: none; }

/* ===== FILES HEADER ===== */
.files-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    flex-wrap: wrap;
    gap: 12px;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.breadcrumb-item {
    cursor: pointer;
    color: #667eea;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 500;
    transition: background 0.2s;
}
.breadcrumb-item:hover { background: #f0f2ff; }

.breadcrumb-separator { color: #cbd5e0; font-size: 0.8rem; }

/* ===== FILES GRID ===== */
.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
}

.file-card, .folder-card {
    background: white;
    border-radius: 14px;
    padding: 15px 16px;
    display: flex;
    align-items: center;
    gap: 13px;
    border: 1.5px solid transparent;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    transition: all 0.22s;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.file-card:hover, .folder-card:hover {
    box-shadow: 0 6px 20px rgba(102,126,234,0.15);
    border-color: rgba(102,126,234,0.25);
    transform: translateY(-2px);
}

.folder-card { cursor: pointer; }

.file-icon { font-size: 30px; flex-shrink: 0; }

.file-info { flex: 1; cursor: pointer; min-width: 0; }

.file-name {
    display: block;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 3px;
    color: #2d3748;
}

.file-meta {
    font-size: 0.78rem;
    color: #a0aec0;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.shared-badge {
    background: #ebf4ff;
    color: #3182ce;
    border-radius: 20px;
    padding: 1px 8px;
    font-size: 0.72rem;
    font-weight: 600;
}

.file-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 6px;
    border-radius: 7px;
    opacity: 0.5;
    transition: all 0.18s;
}
.action-btn:hover { opacity: 1; background: #f0f2f8; }
.action-btn-delete:hover { background: #fff5f5; }

/* ===== EMPTY / LOADING STATES ===== */
.empty-state {
    text-align: center;
    padding: 70px 20px;
    color: #a0aec0;
    grid-column: 1 / -1;
}
.empty-state p { font-size: 1rem; }

.loading-state {
    text-align: center;
    padding: 70px;
    color: #a0aec0;
    grid-column: 1 / -1;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e2e8f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin: 0 auto 14px;
}

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

/* ===== DRAG & DROP ===== */
.drop-overlay {
    position: fixed;
    inset: 0;
    background: rgba(102, 126, 234, 0.08);
    border: 3px dashed #667eea;
    border-radius: 16px;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #667eea;
    font-weight: 600;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.main-content.dragging .drop-overlay { opacity: 1; }

/* ===== MODAL ===== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 20, 40, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.22s;
    backdrop-filter: blur(3px);
}

.modal.modal-visible { opacity: 1; }
.modal.modal-visible .modal-content { transform: translateY(0) scale(1); }

.modal-content {
    background: white;
    border-radius: 18px;
    padding: 28px;
    width: 100%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 25px 60px rgba(0,0,0,0.2);
    transform: translateY(20px) scale(0.97);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.close {
    position: absolute;
    right: 20px;
    top: 18px;
    font-size: 22px;
    cursor: pointer;
    color: #a0aec0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    background: none;
    border: none;
}
.close:hover { color: #e53e3e; background: #fff5f5; }

/* ===== UPLOAD MODAL ===== */
.upload-area {
    border: 2px dashed #cbd5e0;
    border-radius: 12px;
    padding: 36px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    color: #718096;
    margin: 16px 0;
    background: #fafbff;
}

.upload-area:hover, .upload-area.drag-over {
    border-color: #667eea;
    background: #f0f2ff;
    color: #667eea;
}

.upload-area .upload-icon { font-size: 2.5rem; margin-bottom: 10px; }
.upload-area p { font-size: 0.9rem; margin-bottom: 4px; font-weight: 500; }
.upload-area small { font-size: 0.8rem; color: #a0aec0; }
.upload-area input[type="file"] { display: none; }

/* Progress bar */
.progress-wrap {
    margin-top: 14px;
    background: #edf2f7;
    border-radius: 6px;
    height: 8px;
    overflow: hidden;
}

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

.progress-label {
    font-size: 0.8rem;
    color: #718096;
    margin-bottom: 6px;
    text-align: center;
}

/* ===== SHARE MODAL ===== */
.share-options { margin: 16px 0; }

.share-section {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #f0f2f5;
}

.share-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.share-section h4 {
    font-size: 0.88rem;
    color: #4a5568;
    margin-bottom: 10px;
    font-weight: 600;
}

.share-row {
    display: flex;
    gap: 8px;
}

.share-section input,
.share-section select {
    flex: 1;
    padding: 10px 13px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.share-section input:focus,
.share-section select:focus {
    border-color: #667eea;
}

.share-divider {
    text-align: center;
    color: #cbd5e0;
    font-size: 0.8rem;
    margin: 12px 0;
    position: relative;
}
.share-divider::before, .share-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 42%;
    height: 1px;
    background: #e2e8f0;
}
.share-divider::before { left: 0; }
.share-divider::after { right: 0; }

/* Share link zone */
.share-link-zone {
    margin-top: 14px;
    background: #f7f8fc;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px;
}

.share-link-zone label {
    font-size: 0.8rem;
    color: #718096;
    font-weight: 600;
    display: block;
    margin-bottom: 8px;
}

.share-link-row {
    display: flex;
    gap: 8px;
}

.share-link-row input {
    flex: 1;
    padding: 9px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.82rem;
    font-family: monospace;
    background: white;
    outline: none;
    color: #4a5568;
}

/* ===== PROGRESS BAR (legacy) ===== */
.progress-bar {
    height: 5px;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.3s;
    margin-top: 14px;
    border-radius: 3px;
}

/* ===== NOTIFICATIONS ===== */
.badge {
    background: #e53e3e;
    color: white;
    border-radius: 20px;
    padding: 1px 7px;
    font-size: 0.72rem;
    font-weight: 700;
    margin-left: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
}

.notif-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 320px;
    background: white;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
    border: 1.5px solid #e2e8f0;
    overflow: hidden;
    z-index: 500;
    animation: fadeIn 0.2s ease;
}

.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid #f0f2f5;
    font-size: 0.9rem;
}

.notif-mark-read {
    background: none;
    border: none;
    color: #667eea;
    cursor: pointer;
    font-size: 0.8rem;
    font-family: inherit;
}

.notif-body { max-height: 300px; overflow-y: auto; }

.notif-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f8f8f8;
    cursor: pointer;
    transition: background 0.15s;
}
.notif-item:hover { background: #fafbff; }
.notif-item p { font-size: 0.87rem; color: #4a5568; margin-bottom: 3px; }
.notif-item small { color: #a0aec0; font-size: 0.75rem; }
.notif-unread { border-left: 3px solid #667eea; background: #fafbff; }

/* ===== TOAST NOTIFICATIONS ===== */
.toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: #1a202c;
    color: white;
    padding: 13px 18px;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.25);
    z-index: 9999;
    max-width: 380px;
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast.toast-visible { opacity: 1; transform: translateY(0) scale(1); }
.toast.toast-hiding { opacity: 0; transform: translateY(-8px) scale(0.95); transition: all 0.3s ease; }

.toast-success { background: #2f855a; }
.toast-error   { background: #c53030; }
.toast-warning { background: #c05621; }
.toast-info    { background: #2b6cb0; }

.toast-icon { font-size: 1.1rem; flex-shrink: 0; }
.toast-message { flex: 1; }
.toast-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.7);
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    line-height: 1;
    margin-left: 4px;
    transition: color 0.15s;
}
.toast-close:hover { color: white; }

/* ===== GOOGLE DRIVE MODAL ===== */
.gdrive-actions { display: flex; flex-direction: column; gap: 10px; margin: 18px 0; }

.gdrive-ok {
    background: #f0fff4;
    color: #276749;
    border: 1.5px solid #9ae6b4;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

.gdrive-warn {
    background: #fffaf0;
    color: #744210;
    border: 1.5px solid #fbd38d;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
}

.gdrive-files { max-height: 250px; overflow-y: auto; margin-top: 12px; }

.gdrive-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #f0f2f5;
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: background 0.15s;
    font-size: 0.88rem;
}
.gdrive-file-item:hover { background: #f7f8fc; }
.gdrive-file-item strong { display: block; }
.gdrive-file-item small { color: #a0aec0; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar {
        width: 70px;
    }

    .logo h2,
    .user-details,
    .nav-item span:not(.badge) {
        display: none;
    }

    .nav-item { padding: 12px; justify-content: center; }

    .main-content { margin-left: 70px; padding: 18px; }

    .user-info { justify-content: center; }
    .avatar { margin: 0 auto; }

    .files-grid { grid-template-columns: 1fr; }

    .toast { left: 16px; right: 16px; bottom: 16px; width: auto; max-width: none; }
}

@media (max-width: 480px) {
    .top-bar { flex-direction: column; align-items: flex-start; gap: 12px; }
}