/* ============================================================
   SecuriTech — Feuille de styles commune
   Orange SA — v1.0.0
   ============================================================ */

/* ===== VARIABLES — DARK MODE (défaut) ===== */
:root {
    --orange:          #FF6600;
    --orange-dark:     #CC5200;
    --orange-glow:     rgba(255, 102, 0, 0.15);
    --bg:              #0A0A0A;
    --surface:         #141414;
    --surface-2:       #1E1E1E;
    --surface-3:       #282828;
    --border:          rgba(255, 102, 0, 0.2);
    --border-subtle:   rgba(255, 255, 255, 0.06);
    --text:            #FFFFFF;
    --text-secondary:  #888888;
    --text-muted:      #444444;
    --red:             #FF3333;
    --red-glow:        rgba(255, 51, 51, 0.15);
    --green:           #4CAF50;
    --green-glow:      rgba(76, 175, 80, 0.15);
    --blue:            #4DA6FF;
    --blue-glow:       rgba(77, 166, 255, 0.15);
    --yellow:          #FFD600;
}
/* ===== VARIABLES — LIGHT MODE ===== */
body.light {
    --bg:              #F5F5F5;
    --surface:         #FFFFFF;
    --surface-2:       #F0F0F0;
    --surface-3:       #E5E5E5;
    --border:          rgba(255, 102, 0, 0.3);
    --border-subtle:   rgba(0, 0, 0, 0.08);
    --text:            #1A1A1A;
    --text-secondary:  #555555;
    --text-muted:      #AAAAAA;
    --red-glow:        rgba(255, 51, 51, 0.08);
    --green-glow:      rgba(76, 175, 80, 0.08);
    --blue-glow:       rgba(77, 166, 255, 0.08);
    --orange-glow:     rgba(255, 102, 0, 0.08);
}

/* Scanlines désactivées en light mode */
body.light::before { display: none; }


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

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', sans-serif;
    overflow-x: hidden;
}

/* Scanlines subtiles */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.03) 2px,
        rgba(0, 0, 0, 0.03) 4px
    );
    pointer-events: none;
    z-index: 1000;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar              { width: 6px; }
::-webkit-scrollbar-track        { background: transparent; }
::-webkit-scrollbar-thumb        { background: var(--surface-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover  { background: var(--text-muted); }

/* ============================================================
   LAYOUT PRINCIPAL
   ============================================================ */
.app {
    display: grid;
    grid-template-columns: 260px 1fr;
    grid-template-rows: 60px 1fr;
    min-height: 100vh;
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
    grid-column: 1 / -1;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo-icon {
    width: 34px;
    height: 34px;
    background: linear-gradient(135deg, var(--orange), var(--orange-dark));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.logo-text {
    font-family: 'Rajdhani', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 1px;
}

.logo-sub {
    font-size: 10px;
    color: var(--orange);
    letter-spacing: 3px;
    font-weight: 500;
    text-transform: uppercase;
}

.topbar-divider {
    width: 1px;
    height: 30px;
    background: var(--border-subtle);
    margin: 0 8px;
}

.topbar-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--orange);
    letter-spacing: 1px;
}

.topbar-zone {
    font-size: 11px;
    color: var(--orange);
    font-family: 'JetBrains Mono', monospace;
    padding: 3px 10px;
    background: var(--orange-glow);
    border: 1px solid var(--border);
    border-radius: 4px;
    letter-spacing: 0.5px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px var(--green);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text);
}

.user-avatar {
    width: 24px;
    height: 24px;
    background: linear-gradient(135deg, var(--orange), var(--orange-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: white;
}

.btn-logout {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: 5px 12px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: all 0.15s;
}

.btn-logout:hover {
    border-color: var(--red);
    color: var(--red);
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 24px 0;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 60px;
    height: calc(100vh - 60px);
    overflow-y: auto;
}

.sidebar-section {
    padding: 0 16px;
    margin-bottom: 8px;
}

.sidebar-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 2px;
    text-transform: uppercase;
    padding: 8px 8px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 13px;
    color: var(--text-secondary);
    border: 1px solid transparent;
    text-decoration: none;
}

.nav-item:hover {
    background: var(--surface-2);
    color: var(--text);
}

.nav-item.active {
    background: var(--orange-glow);
    border-color: var(--border);
    color: var(--orange);
}

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

.nav-badge {
    margin-left: auto;
    background: var(--red);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    font-family: 'JetBrains Mono', monospace;
}

.nav-badge.green { background: var(--green); }

.sidebar-footer {
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid var(--border-subtle);
}

.sidebar-version {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
    font-family: 'JetBrains Mono', monospace;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main {
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.page-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 1px;
}

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

/* ============================================================
   BOUTONS
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    font-family: 'Inter', sans-serif;
    text-decoration: none;
}

.btn-primary {
    background: var(--orange);
    color: white;
}

.btn-primary:hover {
    background: var(--orange-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border-subtle);
}

.btn-secondary:hover { background: var(--surface-3); }

.btn-danger {
    background: var(--red-glow);
    color: var(--red);
    border: 1px solid rgba(255, 51, 51, 0.3);
}

.btn-danger:hover { background: rgba(255, 51, 51, 0.25); }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body { padding: 20px; }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s;
}

.stat-card:hover { border-color: var(--border); }

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
}

.stat-card.orange::before { background: linear-gradient(90deg, var(--orange), transparent); }
.stat-card.red::before    { background: linear-gradient(90deg, var(--red), transparent); }
.stat-card.green::before  { background: linear-gradient(90deg, var(--green), transparent); }
.stat-card.blue::before   { background: linear-gradient(90deg, var(--blue), transparent); }

.stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 500;
    margin-bottom: 10px;
}

.stat-value {
    font-family: 'Rajdhani', sans-serif;
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 6px;
}

.stat-card.orange .stat-value { color: var(--orange); }
.stat-card.red    .stat-value { color: var(--red); }
.stat-card.green  .stat-value { color: var(--green); }
.stat-card.blue   .stat-value { color: var(--blue); }

.stat-trend { font-size: 12px; color: var(--text-secondary); }

/* ============================================================
   GRILLES
   ============================================================ */
.grid-2   { display: grid; grid-template-columns: 1fr 1fr;  gap: 20px; }
.grid-3-1 { display: grid; grid-template-columns: 2fr 1fr;  gap: 20px; }
.grid-3   { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ============================================================
   TECHNICIENS — LISTE
   ============================================================ */
.technician-list { display: flex; flex-direction: column; }

.technician-row {
    display: grid;
    grid-template-columns: 36px 1fr auto auto;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.15s;
    cursor: pointer;
}

.technician-row:last-child { border-bottom: none; }
.technician-row:hover { background: var(--surface-2); }

.tech-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.tech-info { min-width: 0; }

.tech-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tech-cuid {
    font-size: 11px;
    color: var(--orange);
    font-family: 'JetBrains Mono', monospace;
}

.tech-location {
    font-size: 11px;
    color: var(--text-secondary);
    text-align: right;
    font-family: 'JetBrains Mono', monospace;
}

.tech-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    white-space: nowrap;
}

.tech-status.online  { background: var(--green-glow); color: var(--green); }
.tech-status.offline { background: rgba(255,255,255,0.05); color: var(--text-muted); }
.tech-status.alert   { background: var(--red-glow); color: var(--red); animation: blink 1s infinite; }

/* ============================================================
   ALERTES — LISTE
   ============================================================ */
.alert-list { display: flex; flex-direction: column; }

.alert-row {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: background 0.15s;
}

.alert-row:last-child { border-bottom: none; }
.alert-row:hover { background: var(--surface-2); }

.alert-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 5px;
}

.alert-dot.pending      { background: var(--red);   box-shadow: 0 0 8px var(--red);   animation: pulse-dot 1s infinite; }
.alert-dot.sent         { background: var(--green); }
.alert-dot.acknowledged { background: var(--blue);  }

.alert-content  { flex: 1; min-width: 0; }
.alert-message  { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.alert-meta     { font-size: 11px; color: var(--text-secondary); font-family: 'JetBrains Mono', monospace; }
.alert-coords   { font-size: 11px; color: var(--yellow); font-family: 'JetBrains Mono', monospace; margin-top: 2px; }

.alert-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 4px;
    white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.5px;
}

.alert-badge.PENDING      { background: var(--red-glow);  color: var(--red);   border: 1px solid rgba(255,51,51,0.3); }
.alert-badge.SENT         { background: var(--green-glow); color: var(--green); border: 1px solid rgba(76,175,80,0.3); }
.alert-badge.ACKNOWLEDGED { background: var(--blue-glow);  color: var(--blue);  border: 1px solid rgba(77,166,255,0.3); }

/* ============================================================
   CARTE
   ============================================================ */
.map-placeholder {
    height: 420px;
    background: var(--surface-2);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.map-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,102,0,0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,102,0,0.05) 1px, transparent 1px);
    background-size: 40px 40px;
}

.map-pin {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    cursor: pointer;
    z-index: 2;
}

.map-pin::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    animation: ping 2s infinite;
}

.map-pin.alert-pin          { background: var(--red);   box-shadow: 0 0 12px var(--red); }
.map-pin.alert-pin::after   { border: 1px solid var(--red); }

@keyframes ping {
    0%   { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(3); opacity: 0; }
}

.map-label {
    position: absolute;
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 11px;
    color: var(--text);
    white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
    pointer-events: none;
    z-index: 3;
}

.map-overlay {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: var(--surface);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    gap: 6px;
    z-index: 4;
}

.map-legend-item { display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }

/* ============================================================
   ACTIVITÉ
   ============================================================ */
.activity-list { display: flex; flex-direction: column; }

.activity-item {
    display: flex;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.activity-item:last-child { border-bottom: none; }

.activity-time {
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: var(--text-muted);
    width: 50px;
    flex-shrink: 0;
    padding-top: 2px;
}

.activity-text {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.activity-text strong { color: var(--text); font-weight: 600; }

/* ============================================================
   TABLEAU / TABLE
   ============================================================ */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    padding: 10px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    border-bottom: 1px solid var(--border-subtle);
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.data-table tr:last-child td { border-bottom: none; }

.data-table tr:hover td { background: var(--surface-2); }

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

.form-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    display: block;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border-subtle);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s;
    outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus { border-color: var(--orange); }

.form-select option,
.form-input option  { background: var(--surface-2); }

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

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: 0.5px;
}

.badge-red    { background: var(--red-glow);   color: var(--red);   border: 1px solid rgba(255,51,51,0.3); }
.badge-green  { background: var(--green-glow); color: var(--green); border: 1px solid rgba(76,175,80,0.3); }
.badge-blue   { background: var(--blue-glow);  color: var(--blue);  border: 1px solid rgba(77,166,255,0.3); }
.badge-orange { background: var(--orange-glow); color: var(--orange); border: 1px solid var(--border); }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.4; }
}

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

.fade-in { animation: fadeIn 0.3s ease forwards; }

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

.empty-state-icon { font-size: 36px; opacity: 0.4; }
.empty-state-text { font-size: 14px; color: var(--text-secondary); }
.empty-state-sub  { font-size: 12px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1100px) {
    .stats-grid   { grid-template-columns: repeat(2, 1fr); }
    .grid-3-1     { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .app          { grid-template-columns: 1fr; }
    .sidebar      { display: none; }
    .stats-grid   { grid-template-columns: 1fr 1fr; }
    .grid-2       { grid-template-columns: 1fr; }
}