/**
 * Stonks Admin CSS
 * Petite bibliothèque CSS maison pour l'admin
 */

/* === SHELL : sidebar + main === */
.container {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: #111827;
    color: #e5e7eb;
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
}

.sidebar-header h1 {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 4px;
    color: #fff;
}

.sidebar-header p {
    margin: 0 0 24px;
    font-size: 12px;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    color: #d1d5db;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.nav-link i {
    font-style: normal;
    font-size: 16px;
}

.nav-link:hover {
    background: #1f2937;
    color: #fff;
}

.nav-link.active {
    background: #3b82f6;
    color: #fff;
}

.sidebar-footer {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #1f2937;
    font-size: 12px;
    color: #9ca3af;
}

.main-content {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.header {
    background: #fff;
    padding: 20px 32px;
    border-bottom: 1px solid #e5e7eb;
}

.header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.content {
    padding: 32px;
    flex: 1;
}

/* === LAYOUT === */
.grid {
    display: grid;
    gap: 24px;
}

.grid-2 { grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }

.flex {
    display: flex;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flex-center {
    display: flex;
    align-items: center;
    gap: 8px;
}

.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

/* === SPACING === */
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }

.p-1 { padding: 8px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }

/* === CARDS === */
.card {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card-sm {
    padding: 16px;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* === KPI CARDS === */
.kpi-card {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.kpi-label {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 32px;
    font-weight: bold;
    color: #1f2937;
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.kpi-icon.blue { background: #dbeafe; }
.kpi-icon.green { background: #d1fae5; }
.kpi-icon.purple { background: #e9d5ff; }
.kpi-icon.indigo { background: #e0e7ff; }
.kpi-icon.orange { background: #fed7aa; }
.kpi-icon.red { background: #fee2e2; }

.kpi-info {
    font-size: 13px;
    color: #6b7280;
    margin-top: 8px;
}

/* === BUTTONS === */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s;
}

.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-warning {
    background: #f59e0b;
    color: white;
}

.btn-warning:hover {
    background: #d97706;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

/* === BADGES === */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.badge-gray {
    background: #f3f4f6;
    color: #4b5563;
}

.badge-secondary {
    background: #e5e7eb;
    color: #374151;
}

/* === LABELS (champs de formulaire / detail view) === */
.label {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* === TABLES === */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #f9fafb;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    color: #6b7280;
    border-bottom: 2px solid #e5e7eb;
}

td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
}

tr:hover {
    background: #f9fafb;
}

/* === FORMS === */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #3b82f6;
}

.form-input-sm {
    padding: 8px 12px;
    font-size: 13px;
}

.form-inline {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.form-inline .form-group {
    margin-bottom: 0;
    flex: 1;
}

/* === STATS === */
.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    color: #6b7280;
}

.stat-value {
    font-weight: bold;
}

.stat-value.green { color: #10b981; }
.stat-value.yellow { color: #f59e0b; }
.stat-value.red { color: #ef4444; }
.stat-value.blue { color: #3b82f6; }
.stat-value.gray { color: #1f2937; }

/* === LISTS === */
.list-item {
    border-left: 4px solid;
    padding: 12px 16px;
    background: #f9fafb;
    border-radius: 4px;
    margin-bottom: 12px;
}

.list-item.orange { border-color: #f97316; }
.list-item.red { border-color: #ef4444; }
.list-item.green { border-color: #10b981; }
.list-item.blue { border-color: #3b82f6; }

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 4px;
}

.list-title {
    font-weight: 600;
    color: #1f2937;
}

.list-subtitle {
    font-size: 13px;
    color: #6b7280;
}

.list-meta {
    font-size: 13px;
    color: #6b7280;
}

/* === ALERTS === */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* === TEXT === */
.text-xs { font-size: 12px; }
.text-sm { font-size: 14px; }
.text-base { font-size: 16px; }
.text-lg { font-size: 18px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }
.text-3xl { font-size: 32px; }

.text-bold { font-weight: bold; }
.text-semibold { font-weight: 600; }
.text-medium { font-weight: 500; }

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.text-gray { color: #6b7280; }
.text-dark { color: #1f2937; }
.text-green { color: #10b981; }
.text-red { color: #ef4444; }
.text-yellow { color: #f59e0b; }
.text-blue { color: #3b82f6; }

/* === LINKS === */
.link {
    color: #3b82f6;
    text-decoration: none;
}

.link:hover {
    color: #2563eb;
    text-decoration: underline;
}

.link-button {
    display: block;
    text-align: center;
    margin-top: 16px;
    color: #3b82f6;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.link-button:hover {
    color: #2563eb;
    text-decoration: underline;
}

/* === MISC === */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #9ca3af;
}

.divider {
    height: 1px;
    background: #e5e7eb;
    margin: 24px 0;
}

.rounded { border-radius: 8px; }
.rounded-sm { border-radius: 4px; }
.rounded-lg { border-radius: 12px; }
.rounded-full { border-radius: 9999px; }

.shadow { box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.shadow-md { box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); }
.shadow-lg { box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1); }

/* === FILTERS BAR === */
.filters-bar {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
}

.filters-form {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.filters-form .form-group {
    margin-bottom: 0;
}

.filters-form .search-input {
    flex: 1;
}

/* === PAGINATION === */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
}

.pagination a,
.pagination span {
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    text-decoration: none;
    color: #4b5563;
}

.pagination a:hover {
    background: #f3f4f6;
}

.pagination .active {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

/* === LOGIN === */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    padding: 24px;
}

.login-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    padding: 32px;
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 4px;
}

.login-header p {
    color: #6b7280;
    font-size: 14px;
    margin: 0;
}

.login-form .form-group {
    margin-bottom: 16px;
}

.logout-link {
    background: none;
    border: none;
    padding: 0;
    color: #9ca3af;
    cursor: pointer;
    font: inherit;
    text-decoration: underline;
}

.logout-link:hover {
    color: #fff;
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        padding: 16px;
    }

    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .sidebar-footer {
        display: none;
    }

    .content {
        padding: 16px;
    }

    .header {
        padding: 16px;
    }

    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr;
    }

    .kpi-value {
        font-size: 24px;
    }

    .filters-form {
        flex-direction: column;
        align-items: stretch;
    }

    .filters-form .form-group {
        width: 100%;
    }
}
