/**
 * iRemba by Itabba v2.0 - Styles Professionnels
 * Theme: Orange / Bleu / Blanc - Mode Sombre Noir/Orange
 * Sans degrades
 */

:root {
    --color-primary: #FF6B00;
    --color-primary-hover: #E55A00;
    --color-secondary: #0066CC;
    --color-secondary-hover: #0055AA;
    --color-bg: #F5F7FA;
    --color-surface: #FFFFFF;
    --color-text: #1A1A2E;
    --color-text-muted: #6B7280;
    --color-border: #E5E7EB;
    --color-success: #10B981;
    --color-danger: #EF4444;
    --color-warning: #F59E0B;
    --sidebar-width: 260px;
    --header-height: 60px;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.05);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.12), 0 8px 24px rgba(0,0,0,0.08);
}

[data-theme="dark"] {
    --color-bg: #0F0F0F;
    --color-surface: #1A1A1A;
    --color-text: #E8E8E8;
    --color-text-muted: #9CA3AF;
    --color-border: #2D2D2D;
    --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 4px 12px rgba(0,0,0,0.2);
    --shadow-hover: 0 4px 12px rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.3);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    font-size: 14px;
    line-height: 1.5;
    overflow-x: hidden;
    transition: background-color 0.3s, color 0.3s;
}

/* ===== HEADER ===== */
.app-header {
    position: fixed; top: 0; left: 0; right: 0; height: var(--header-height);
    background: var(--color-surface); border-bottom: 1px solid var(--color-border);
    z-index: 1030; display: flex; align-items: center; padding: 0 20px;
    transition: background 0.3s, border 0.3s;
}

.brand {
    display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--color-text);
    font-size: 1.3rem; font-weight: 700; margin-right: 30px;
}
.brand-icon { width: 36px; height: 36px; ); border-radius: 10px;
    display: flex; align-items: center; justify-content: center; color: white; font-size: 1.1rem; }
.brand span { color: var(--color-primary); }
.brand small { font-size: 0.6em; color: var(--color-text-muted); font-weight: 500; margin-left: 4px; }

.search-bar {
    flex: 1; max-width: 500px; position: relative;
}
.search-bar input {
    width: 100%; padding: 10px 16px 10px 40px; border-radius: 50px; border: 1px solid var(--color-border);
    background: var(--color-bg); color: var(--color-text); font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-bar input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(255,107,0,0.15); }
.search-bar i { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--color-text-muted); }

.header-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }

.btn-icon {
    width: 38px; height: 38px; border-radius: 50%; border: none;
    background: transparent; color: var(--color-text-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s; font-size: 1rem;
}
.btn-icon:hover { background: var(--color-bg); color: var(--color-primary); }

.storage-mini { display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 50px;
    background: var(--color-bg); border: 1px solid var(--color-border); }
.storage-mini .progress { width: 80px; height: 5px; background: var(--color-border); border-radius: 3px; overflow: hidden; }
.storage-mini .progress-bar { height: 100%; background: var(--color-primary); border-radius: 3px; transition: width 0.3s; }
.storage-mini span { font-size: 0.75rem; color: var(--color-text-muted); white-space: nowrap; }

.user-avatar {
    width: 36px; height: 36px; border-radius: 50%; background: var(--color-secondary);
    display: flex; align-items: center; justify-content: center; color: white;
    font-weight: 600; font-size: 0.85rem; cursor: pointer; border: 2px solid var(--color-border);
}

/* ===== SIDEBAR ===== */
.app-sidebar {
    position: fixed; top: var(--header-height); left: 0; bottom: 0; width: var(--sidebar-width);
    background: var(--color-surface); border-right: 1px solid var(--color-border);
    z-index: 1020; overflow-y: auto; padding: 16px; transition: all 0.3s;
}

.btn-new {
    width: 100%; padding: 12px; border-radius: var(--radius); border: none;
    background: var(--color-primary); color: white; font-weight: 600; font-size: 0.95rem;
    cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
    margin-bottom: 16px; transition: background 0.2s; box-shadow: 0 2px 8px rgba(255,107,0,0.3);
}
.btn-new:hover { background: var(--color-primary-hover); }

.nav-menu { list-style: none; }
.nav-menu li { margin-bottom: 2px; }
.nav-menu a {
    display: flex; align-items: center; gap: 12px; padding: 10px 14px;
    border-radius: 10px; color: var(--color-text-muted); text-decoration: none;
    font-weight: 500; font-size: 0.9rem; transition: all 0.2s;
}
.nav-menu a i { width: 20px; text-align: center; font-size: 1rem; }
.nav-menu a:hover { background: var(--color-bg); color: var(--color-text); }
.nav-menu a.active { background: rgba(255,107,0,0.1); color: var(--color-primary); }

.sidebar-section { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--color-border); }
.sidebar-section h6 { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 1px; color: var(--color-text-muted); margin-bottom: 12px; padding-left: 14px; }

.storage-chart-container { padding: 0 8px; }
.storage-chart-container canvas { max-height: 140px !important; }
.storage-info { text-align: center; margin-top: 8px; font-size: 0.8rem; color: var(--color-text-muted); }
.storage-info strong { color: var(--color-primary); }

/* ===== MAIN CONTENT ===== */
.app-main {
    margin-left: var(--sidebar-width); margin-top: var(--header-height);
    padding: 24px; min-height: calc(100vh - var(--header-height));
    transition: margin-left 0.3s;
}

/* Breadcrumb */
.breadcrumb-bar {
    display: flex; align-items: center; gap: 8px; margin-bottom: 20px; flex-wrap: wrap;
}
.breadcrumb-bar a { color: var(--color-text-muted); text-decoration: none; font-size: 0.85rem; transition: color 0.2s; }
.breadcrumb-bar a:hover { color: var(--color-primary); }
.breadcrumb-bar a.active { color: var(--color-text); font-weight: 600; }
.breadcrumb-bar i { color: var(--color-text-muted); font-size: 0.7rem; }

/* Toolbar */
.toolbar {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 10px;
}
.view-toggle { display: flex; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 8px; overflow: hidden; }
.view-toggle button {
    padding: 8px 14px; border: none; background: transparent; color: var(--color-text-muted);
    cursor: pointer; font-size: 0.85rem; transition: all 0.2s;
}
.view-toggle button.active { background: var(--color-primary); color: white; }
.view-toggle button:hover:not(.active) { background: var(--color-bg); color: var(--color-text); }

/* Drop Zone */
.drop-zone {
    border: 2px dashed var(--color-border); border-radius: var(--radius);
    padding: 40px; text-align: center; color: var(--color-text-muted);
    background: var(--color-surface); margin-bottom: 20px; display: none;
    transition: all 0.3s;
}
.drop-zone.drag-over { border-color: var(--color-primary); background: rgba(255,107,0,0.03); color: var(--color-primary); }
.drop-zone i { font-size: 2.5rem; margin-bottom: 8px; display: block; }

/* Content Grid */
.content-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px;
}

.item-card {
    background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: var(--radius); padding: 16px; cursor: pointer;
    transition: all 0.2s ease; position: relative; user-select: none;
    display: flex; flex-direction: column; align-items: center; text-align: center;
}
.item-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--color-primary); }
.item-card.selected { border-color: var(--color-primary); background: rgba(255,107,0,0.05); }
.item-card.selected::after {
    content: '\f00c'; font-family: 'Font Awesome 6 Free'; font-weight: 900;
    position: absolute; top: 8px; right: 8px; width: 22px; height: 22px;
    background: var(--color-primary); color: white; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-size: 0.65rem;
}

.item-icon {
    width: 56px; height: 56px; border-radius: 14px;
    background: var(--color-bg); display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem; margin-bottom: 12px; color: var(--color-text-muted);
    transition: all 0.2s;
}
.item-card:hover .item-icon { color: var(--color-primary); }
.item-card.image .item-icon {
    background-size: cover; background-position: center; width: 100%; height: 120px; border-radius: 8px; margin-bottom: 10px;
}

.item-name { font-size: 0.85rem; font-weight: 500; color: var(--color-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; width: 100%; }
.item-meta { font-size: 0.7rem; color: var(--color-text-muted); margin-top: 4px; }
.item-fav { position: absolute; top: 8px; left: 8px; color: var(--color-warning); font-size: 0.75rem; }

/* List View */
.list-view { display: none; }
.list-view.active { display: block; }
.data-table { width: 100%; border-collapse: collapse; background: var(--color-surface); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--color-border); }
.data-table th, .data-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--color-border); font-size: 0.85rem; }
.data-table th { background: var(--color-bg); font-weight: 600; color: var(--color-text-muted); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; }
.data-table tr:hover { background: var(--color-bg); }
.data-table td .file-icon-sm { width: 32px; height: 32px; border-radius: 8px; background: var(--color-bg); display: inline-flex; align-items: center; justify-content: center; margin-right: 10px; color: var(--color-text-muted); }
.data-table td .file-icon-sm img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; }

/* Context Menu */
.context-menu {
    position: fixed; background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: 10px; box-shadow: var(--shadow-hover); z-index: 2000;
    min-width: 200px; padding: 6px 0; display: none;
}
.context-menu-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 16px;
    color: var(--color-text); text-decoration: none; font-size: 0.85rem; cursor: pointer; transition: background 0.15s;
}
.context-menu-item:hover { background: var(--color-bg); }
.context-menu-item i { width: 18px; text-align: center; color: var(--color-text-muted); }
.context-menu-item.danger { color: var(--color-danger); }
.context-menu-item.danger i { color: var(--color-danger); }
.context-menu-divider { height: 1px; background: var(--color-border); margin: 6px 0; }

/* Modals */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 3000; display: none; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.modal-overlay.active { display: flex; }
.modal-box { background: var(--color-surface); border-radius: var(--radius); width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3); animation: modalIn 0.25s ease; }
.modal-header { padding: 20px 24px 0; display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 1.1rem; font-weight: 600; }
.modal-close { width: 32px; height: 32px; border-radius: 50%; border: none; background: var(--color-bg); color: var(--color-text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.modal-close:hover { background: var(--color-border); color: var(--color-text); }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 0 24px 20px; display: flex; gap: 10px; justify-content: flex-end; }

@keyframes modalIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--color-text-muted); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 10px 14px; border-radius: 8px; border: 1px solid var(--color-border);
    background: var(--color-bg); color: var(--color-text); font-size: 0.9rem; transition: border-color 0.2s, box-shadow 0.2s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px rgba(255,107,0,0.12); }

.btn {
    padding: 10px 20px; border-radius: 8px; border: none; font-weight: 600; font-size: 0.85rem;
    cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: all 0.2s;
}
.btn-primary { background: var(--color-primary); color: white; }
.btn-primary:hover { background: var(--color-primary-hover); }
.btn-secondary { background: var(--color-secondary); color: white; }
.btn-secondary:hover { background: var(--color-secondary-hover); }
.btn-outline { background: transparent; border: 1px solid var(--color-border); color: var(--color-text); }
.btn-outline:hover { background: var(--color-bg); }
.btn-danger { background: var(--color-danger); color: white; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-block { width: 100%; justify-content: center; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--color-border); margin-bottom: 16px; }
.tab-btn { padding: 10px 16px; border: none; background: transparent; color: var(--color-text-muted); font-weight: 500; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: all 0.2s; }
.tab-btn.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Progress */
.progress-track { width: 100%; height: 6px; background: var(--color-border); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--color-primary); border-radius: 3px; transition: width 0.3s; }

/* Toast */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 4000; display: flex; flex-direction: column; gap: 10px; }
.toast {
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 10px;
    padding: 14px 20px; box-shadow: var(--shadow-hover); display: flex; align-items: center; gap: 10px;
    animation: toastIn 0.3s ease; min-width: 280px;
}
.toast.success { border-left: 4px solid var(--color-success); }
.toast.error { border-left: 4px solid var(--color-danger); }
.toast.warning { border-left: 4px solid var(--color-warning); }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Login Page */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--color-bg); padding: 20px; }
.login-card { background: var(--color-surface); border-radius: var(--radius); padding: 40px; width: 100%; max-width: 420px; box-shadow: var(--shadow); border: 1px solid var(--color-border); }
.login-brand { text-align: center; margin-bottom: 32px; }
.login-brand .brand-icon { width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 16px; }
.login-brand h1 { font-size: 1.6rem; font-weight: 700; }
.login-brand h1 span { color: var(--color-primary); }
.login-brand p { color: var(--color-text-muted); font-size: 0.9rem; margin-top: 4px; }

/* Share Page */
.share-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--color-bg); padding: 20px; }
.share-card { background: var(--color-surface); border-radius: var(--radius); padding: 40px; width: 100%; max-width: 480px; box-shadow: var(--shadow); border: 1px solid var(--color-border); text-align: center; }
.share-file-icon { font-size: 4rem; color: var(--color-primary); margin: 20px 0; }

/* Purchase Page */
.purchase-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-top: 20px; }
.purchase-card { background: var(--color-surface); border: 2px solid var(--color-border); border-radius: var(--radius); padding: 24px; text-align: center; transition: all 0.2s; }
.purchase-card:hover { border-color: var(--color-primary); transform: translateY(-2px); }
.purchase-card .size { font-size: 2rem; font-weight: 700; color: var(--color-primary); }
.purchase-card .price { font-size: 1.2rem; color: var(--color-text); margin: 8px 0; }
.purchase-card .price span { font-size: 0.8rem; color: var(--color-text-muted); }

/* Admin */
.admin-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 20px; }
.stat-card h4 { font-size: 0.75rem; text-transform: uppercase; color: var(--color-text-muted); margin-bottom: 8px; }
.stat-card .value { font-size: 1.8rem; font-weight: 700; color: var(--color-primary); }

/* Mobile Menu Toggle */
.mobile-toggle { display: none; background: none; border: none; color: var(--color-text); font-size: 1.2rem; cursor: pointer; margin-right: 12px; }

/* Responsive */
@media (max-width: 991px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.open { transform: translateX(0); }
    .app-main { margin-left: 0; }
    .mobile-toggle { display: block; }
    .search-bar { max-width: 300px; }
    .storage-mini { display: none; }
}

@media (max-width: 767px) {
    .app-main { padding: 16px; }
    .content-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
    .item-icon { width: 44px; height: 44px; font-size: 1.3rem; }
    .search-bar { display: none; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .modal-box { margin: 16px; max-height: calc(100vh - 32px); }
}

@media (max-width: 480px) {
    .content-grid { grid-template-columns: repeat(2, 1fr); }
    .login-card, .share-card { padding: 24px; }
}

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.item-card { animation: fadeIn 0.25s ease forwards; }
