/* ===========================================
   ALTRIS Super Admin — Stylesheet
   Branding : Teal #0D5C63
   =========================================== */

:root {
    --primary: #0D5C63;
    --primary-dark: #094249;
    --primary-light: #0E6E77;
    --secondary: #E8F4F5;
    --accent: #FF6B35;
    --accent-hover: #E55A28;

    --bg: #F5F7FA;
    --bg-white: #FFFFFF;
    --text: #1A2332;
    --text-muted: #6B7A8D;
    --border: #E2E8F0;
    --border-light: #F0F3F6;

    --success: #059669;
    --success-bg: #ECFDF5;
    --error: #DC2626;
    --error-bg: #FEF2F2;
    --warning: #D97706;
    --warning-bg: #FFFBEB;
    --info: #2563EB;
    --info-bg: #EFF6FF;

    --sidebar-width: 240px;
    --radius: 8px;
    --radius-sm: 4px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --transition: 150ms ease;
}

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

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

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Login Page ---- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-container {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    width: 100%;
    max-width: 400px;
    padding: 40px;
}

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

.login-logo {
    font-size: 28px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: 3px;
}

.login-sub {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-top: 4px;
}

.login-title {
    font-size: 18px;
    margin-bottom: 6px;
}

.login-text {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

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

/* ---- Sidebar ---- */
.sidebar {
    position: fixed;
    left: 0; top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--primary);
    color: #fff;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.logo {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: 3px;
    color: #fff;
}

.logo-sub {
    font-size: 11px;
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.nav-list {
    list-style: none;
    padding: 12px 0;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.75);
    font-size: 14px;
    transition: all var(--transition);
}

.nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);
    text-decoration: none;
}

.nav-link.active {
    color: #fff;
    background: rgba(255,255,255,0.12);
    border-right: 3px solid var(--accent);
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 12px;
}

.admin-email {
    display: block;
    color: rgba(255,255,255,0.5);
    margin-bottom: 8px;
    word-break: break-all;
}

.btn-logout {
    color: rgba(255,255,255,0.7);
    font-size: 12px;
}
.btn-logout:hover { color: #fff; }

/* ---- Content ---- */
.content {
    margin-left: var(--sidebar-width);
    padding: 30px 40px;
    min-height: 100vh;
}

/* ---- Page Header ---- */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    display: inline;
    margin-right: 10px;
}

.page-actions { display: flex; gap: 8px; }

.back-link {
    display: inline-block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.back-link:hover { color: var(--primary); }

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

.stat-card {
    background: var(--bg-white);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    text-align: center;
    transition: all var(--transition);
    cursor: pointer;
    color: var(--text);
}
.stat-card:hover { border-color: var(--primary); text-decoration: none; box-shadow: var(--shadow); }
.stat-card.stat-active { border-color: var(--primary); box-shadow: var(--shadow-md); }

.stat-number { display: block; font-size: 28px; font-weight: 700; }
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }

.stat-actif .stat-number { color: var(--success); }
.stat-prelivraison .stat-number { color: var(--info); }
.stat-maintenance .stat-number { color: var(--warning); }
.stat-suspendu .stat-number { color: var(--error); }

/* ---- Search ---- */
.search-bar { margin-bottom: 24px; }

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

.search-input {
    flex: 1;
    max-width: 400px;
}

/* ---- Table ---- */
.table-wrapper {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
}

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

.table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    background: var(--bg);
}

.table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.table tbody tr:hover { background: var(--secondary); }
.table tbody tr:last-child td { border-bottom: none; }

.link-external { font-size: 13px; }
.text-muted { color: var(--text-muted); }
.module-count {
    display: inline-block;
    background: var(--secondary);
    color: var(--primary);
    font-weight: 600;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
}

/* ---- Badges ---- */
.badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-actif { background: var(--success-bg); color: var(--success); }
.status-prelivraison { background: var(--info-bg); color: var(--info); }
.status-maintenance { background: var(--warning-bg); color: var(--warning); }
.status-suspendu { background: var(--error-bg); color: var(--error); }

/* ---- Cards ---- */
.card {
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}

.card h2 { font-size: 18px; margin-bottom: 8px; }
.card h3 { font-size: 15px; margin: 20px 0 10px; color: var(--primary); }

/* ---- Tabs ---- */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
}

.tab {
    padding: 10px 20px;
    border: none;
    background: none;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition);
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---- Status Buttons ---- */
.status-form { margin-top: 16px; }

.status-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-status {
    flex: 1;
    min-width: 120px;
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-white);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}

.btn-status:hover:not(:disabled) { box-shadow: var(--shadow-md); }
.btn-status:disabled { opacity: 1; cursor: default; }
.btn-status small { font-weight: 400; opacity: 0.7; }

.btn-status.status-prelivraison { color: var(--info); }
.btn-status.status-prelivraison.current { border-color: var(--info); background: var(--info-bg); }
.btn-status.status-actif { color: var(--success); }
.btn-status.status-actif.current { border-color: var(--success); background: var(--success-bg); }
.btn-status.status-maintenance { color: var(--warning); }
.btn-status.status-maintenance.current { border-color: var(--warning); background: var(--warning-bg); }
.btn-status.status-suspendu { color: var(--error); }
.btn-status.status-suspendu.current { border-color: var(--error); background: var(--error-bg); }

/* ---- Info Box ---- */
.info-box {
    margin-top: 20px;
    padding: 12px 16px;
    background: var(--secondary);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.copyable {
    cursor: pointer;
    background: var(--bg-white);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    user-select: all;
}

/* ---- Modules Grid ---- */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}

.module-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}

.module-item:hover { border-color: var(--primary-light); }
.module-item.module-active { border-color: var(--primary); background: var(--secondary); }
.module-item.module-base { opacity: 0.7; cursor: default; }

.module-item input[type="checkbox"] { accent-color: var(--primary); }
.module-name { flex: 1; font-weight: 500; }
.module-price { font-size: 12px; color: var(--text-muted); }

/* ---- Actions List ---- */
.actions-list { display: flex; flex-direction: column; gap: 16px; }

.action-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.action-item strong { display: block; margin-bottom: 2px; }
.action-item .text-muted { font-size: 13px; }

.action-danger { border-color: var(--error); background: var(--error-bg); }

.delete-form {
    padding: 16px;
    border: 1px solid var(--error);
    border-radius: var(--radius);
    background: var(--error-bg);
    margin-top: -8px;
}

.form-inline {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

/* ---- Timeline ---- */
.timeline { max-height: 400px; overflow-y: auto; }

.timeline-item {
    display: flex;
    gap: 16px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
}

.timeline-date {
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 12px;
    font-family: monospace;
    min-width: 150px;
}

/* ---- Forms ---- */
.form-group {
    margin-bottom: 16px;
}

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

input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="tel"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-white);
    color: var(--text);
    transition: border-color var(--transition);
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 92, 99, 0.1);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
}

.form-grid-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

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

.color-input input[type="color"] {
    width: 40px;
    height: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 2px;
    cursor: pointer;
}

.color-text {
    width: 100px !important;
    font-family: monospace;
    font-size: 13px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; color: #fff; }

.btn-secondary { background: var(--secondary); color: var(--primary); }
.btn-secondary:hover { background: #D3ECEE; text-decoration: none; }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); text-decoration: none; }

.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover { background: #B91C1C; text-decoration: none; color: #fff; }

.btn-small { padding: 5px 12px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; }

/* ---- Alerts ---- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-success { background: var(--success-bg); color: var(--success); border-left: 3px solid var(--success); }
.alert-error { background: var(--error-bg); color: var(--error); border-left: 3px solid var(--error); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-left: 3px solid var(--warning); }
.alert-info { background: var(--info-bg); color: var(--info); border-left: 3px solid var(--info); }

.alert ul { margin: 4px 0 0 20px; }

/* ---- Empty State ---- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    color: var(--text-muted);
}

.empty-state p { margin-bottom: 16px; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .sidebar-header { padding: 16px; }

    .nav-list {
        display: flex;
        padding: 0;
        overflow-x: auto;
    }

    .nav-link {
        padding: 10px 16px;
        white-space: nowrap;
        font-size: 13px;
    }

    .nav-link.active { border-right: none; border-bottom: 3px solid var(--accent); }

    .sidebar-footer {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 16px;
    }

    .admin-email { margin: 0; }

    .content {
        margin-left: 0;
        padding: 20px 16px;
    }

    .page-header { flex-direction: column; }
    .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .status-buttons { flex-direction: column; }
    .modules-grid { grid-template-columns: 1fr; }
    .search-form { flex-wrap: wrap; }
    .search-input { max-width: 100%; }
}
