/* NovaDev License System - Shared CSS - Copyright (c) 2026 YoannFM */

/* ===== CSS VARIABLES ===== */
:root,
[data-theme="dark"] {
    --bg: #0d0d14;
    --surface: #13131f;
    --elevated: #1a1a2b;
    --border: #1e1e30;
    --border-subtle: #16162a;

    --text-primary: #e2e2f0;
    --text-secondary: #8b8ba7;
    --text-muted: #4a4a6a;

    --accent: #7c6af7;
    --accent-hover: #9580ff;
    --accent-dim: rgba(124, 106, 247, 0.15);

    --success: #22c55e;
    --success-dim: rgba(34, 197, 94, 0.12);
    --error: #ef4444;
    --error-dim: rgba(239, 68, 68, 0.12);
    --warning: #f59e0b;
    --warning-dim: rgba(245, 158, 11, 0.12);
    --info: #38bdf8;
    --info-dim: rgba(56, 189, 248, 0.12);

    --shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);

    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --sidebar-width: 240px;
    --topbar-height: 64px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg: #f0f0f8;
    --surface: #ffffff;
    --elevated: #f8f8ff;
    --border: #e2e2ea;
    --border-subtle: #ebebf3;

    --text-primary: #1a1a2e;
    --text-secondary: #6b6b85;
    --text-muted: #9b9bbb;

    --accent: #6c5ce7;
    --accent-hover: #5a4bd5;
    --accent-dim: rgba(108, 92, 231, 0.10);

    --success: #16a34a;
    --success-dim: rgba(22, 163, 74, 0.08);
    --error: #dc2626;
    --error-dim: rgba(220, 38, 38, 0.08);
    --warning: #d97706;
    --warning-dim: rgba(217, 119, 6, 0.08);
    --info: #0284c7;
    --info-dim: rgba(2, 132, 199, 0.08);

    --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg);
    color: var(--text-primary);
    line-height: 1.5;
    transition: background-color var(--transition), color var(--transition);
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
}

input, select, textarea {
    font-family: inherit;
}

/* ===== CUSTOM SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

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

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    z-index: 100;
    transition: background-color var(--transition), border-color var(--transition), transform var(--transition);
}

/* ===== SIDEBAR LOGO ===== */
.sidebar-logo {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.logo-icon {
    width: 40px;
    height: 40px;
    background-color: var(--accent-dim);
    border: 1px solid var(--accent);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.logo-text {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.logo-version {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1;
}

/* ===== SIDEBAR NAV ===== */
.sidebar-nav {
    padding: 16px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.nav-section-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 8px 8px 4px;
    display: block;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: background-color var(--transition), color var(--transition);
    margin-bottom: 2px;
    cursor: pointer;
    text-decoration: none;
}

.nav-item:hover {
    background-color: var(--elevated);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: var(--accent-dim);
    color: var(--accent);
}

.nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* ===== SIDEBAR FOOTER ===== */
.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

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

/* ===== TOPBAR ===== */
.topbar {
    height: var(--topbar-height);
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 90;
    transition: background-color var(--transition), border-color var(--transition);
    flex-shrink: 0;
}

.topbar-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.topbar-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 1px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* ===== THEME TOGGLE ===== */
.theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background-color: var(--elevated);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: border-color var(--transition), color var(--transition), background-color var(--transition);
}

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

/* ===== PAGE CONTENT ===== */
.page-content {
    padding: 28px;
    flex: 1;
}

/* ===== CARD ===== */
.card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: background-color var(--transition), border-color var(--transition);
}

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

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* ===== STAT CARD ===== */
.stat-card {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition), background-color var(--transition);
    cursor: default;
}

.stat-card:hover {
    border-color: var(--accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.stat-icon.accent {
    background-color: var(--accent-dim);
}

.stat-icon.success {
    background-color: var(--success-dim);
}

.stat-icon.warning {
    background-color: var(--warning-dim);
}

.stat-icon.error {
    background-color: var(--error-dim);
}

.stat-icon.info {
    background-color: var(--info-dim);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ===== GRIDS ===== */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.grid-auto {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background-color var(--transition), color var(--transition), border-color var(--transition), opacity var(--transition);
    white-space: nowrap;
    font-family: inherit;
}

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

.btn-primary {
    background-color: var(--accent);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
}

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

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

.btn-danger {
    background-color: var(--error-dim);
    color: var(--error);
    border: 1px solid var(--error);
}

.btn-danger:hover {
    background-color: var(--error);
    color: #ffffff;
}

.btn-success {
    background-color: var(--success-dim);
    color: var(--success);
    border: 1px solid var(--success);
}

.btn-success:hover {
    background-color: var(--success);
    color: #ffffff;
}

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

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    justify-content: center;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 12px;
    font-weight: 500;
}

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

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

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

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

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

.badge-neutral {
    background-color: var(--elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

/* ===== STATUS DOT ===== */
.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.status-dot.green {
    background-color: var(--success);
}

.status-dot.red {
    background-color: var(--error);
}

.status-dot.yellow {
    background-color: var(--warning);
}

/* ===== TABLE ===== */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

thead th {
    background-color: var(--elevated);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-primary);
    vertical-align: middle;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover td {
    background-color: var(--elevated);
}

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

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    background-color: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-select option {
    background-color: var(--surface);
}

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

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

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

.modal {
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    padding: 28px;
    box-shadow: var(--shadow);
    transform: translateY(-10px);
    transition: transform 0.2s;
}

.modal-overlay.open .modal {
    transform: translateY(0);
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

.actions-cell {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ===== UPTIME BARS ===== */
.uptime-grid {
    display: flex;
    gap: 2px;
    align-items: flex-end;
    height: 40px;
    padding: 4px 0;
}

.uptime-bar {
    flex: 1;
    border-radius: 2px;
    cursor: default;
    min-width: 4px;
    transition: opacity var(--transition);
}

.uptime-bar.active {
    background-color: var(--success);
    height: 100%;
}

.uptime-bar.inactive {
    background-color: var(--error-dim);
    height: 30%;
}

.uptime-bar.unknown {
    background-color: var(--border);
    height: 20%;
}

.uptime-bar:hover {
    opacity: 0.75;
    cursor: crosshair;
}

/* ===== TOOLTIP ===== */
#nd-tooltip {
    position: fixed;
    z-index: 9999;
    background: var(--elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-primary);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.1s ease;
    white-space: nowrap;
    box-shadow: var(--shadow);
    min-width: 150px;
}

#nd-tooltip.visible {
    opacity: 1;
}

#nd-tooltip .tip-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    margin-bottom: 5px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--border-subtle);
}

#nd-tooltip .tip-row {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 3px;
    line-height: 1.5;
}

#nd-tooltip .tip-label {
    color: var(--text-secondary);
    font-size: 11px;
}

#nd-tooltip .tip-value {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 11px;
    text-align: right;
}

/* Curseur crosshair sur les rects SVG des statuspage bars */
.status-bars-wrap svg rect {
    cursor: crosshair;
}

/* ===== TOAST ===== */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background-color: var(--elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    min-width: 280px;
    max-width: 400px;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow);
    animation: slideInRight 0.3s ease;
    font-size: 14px;
    color: var(--text-primary);
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.error {
    border-left: 3px solid var(--error);
}

.toast.warning {
    border-left: 3px solid var(--warning);
}

.toast.info {
    border-left: 3px solid var(--info);
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===== SEARCH BAR ===== */
.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background-color: var(--elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    transition: border-color var(--transition);
}

.search-bar:focus-within {
    border-color: var(--accent);
}

.search-bar input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 14px;
    width: 200px;
    font-family: inherit;
}

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

.search-icon {
    color: var(--text-muted);
    font-size: 14px;
    flex-shrink: 0;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    text-align: center;
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-desc {
    font-size: 14px;
    color: var(--text-muted);
}

.empty-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ===== LOADING SPINNER ===== */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    flex-shrink: 0;
}

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

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

.text-secondary {
    color: var(--text-secondary);
}

.text-accent {
    color: var(--accent);
}

.text-success {
    color: var(--success);
}

.text-error {
    color: var(--error);
}

.text-warning {
    color: var(--warning);
}

.font-mono {
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}

.font-bold {
    font-weight: 700;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 12px;
}

.gap-4 {
    gap: 16px;
}

.mb-2 {
    margin-bottom: 8px;
}

.mb-4 {
    margin-bottom: 16px;
}

.mb-6 {
    margin-bottom: 24px;
}

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

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

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

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .page-content {
        padding: 16px;
    }

    .topbar {
        padding: 0 16px;
    }
}
