/* ============================================================
   MCC – Main Stylesheet
   Military Command Center Design System
   ============================================================ */

/* ─── Google Fonts ──────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ─── CSS Variables ─────────────────────────────────────── */
:root {
    /* Background layers */
    --bg-deep:       #0d0d1a;
    --bg-primary:    #1a1a2e;
    --bg-secondary:  #16213e;
    --bg-card:       #1e2a45;
    --bg-card-hover: #243352;
    --bg-input:      #141b2d;
    --bg-surface:    rgba(30, 42, 69, 0.85);

    /* Accent colors */
    --accent:        #f0a500;
    --accent-glow:   rgba(240, 165, 0, 0.3);
    --accent-hover:  #ffb733;

    /* Status colors */
    --success:       #00b894;
    --success-bg:    rgba(0, 184, 148, 0.12);
    --success-border:rgba(0, 184, 148, 0.3);
    --warning:       #fdcb6e;
    --warning-bg:    rgba(253, 203, 110, 0.12);
    --warning-border:rgba(253, 203, 110, 0.3);
    --danger:        #e74c3c;
    --danger-bg:     rgba(231, 76, 60, 0.12);
    --danger-border: rgba(231, 76, 60, 0.3);
    --info:          #74b9ff;
    --info-bg:       rgba(116, 185, 255, 0.12);
    --info-border:   rgba(116, 185, 255, 0.3);

    /* Text */
    --text-primary:  #e8e8f0;
    --text-secondary:#9ca3b8;
    --text-muted:    #6c7293;
    --text-inverse:  #0d0d1a;

    /* Borders */
    --border:        rgba(255, 255, 255, 0.08);
    --border-focus:  rgba(240, 165, 0, 0.5);

    /* Shadows */
    --shadow-sm:     0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md:     0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg:     0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow:   0 0 20px rgba(240, 165, 0, 0.15);

    /* Typography */
    --font-sans:     'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono:     'JetBrains Mono', 'Fira Code', monospace;

    /* Sizes */
    --radius-sm:     6px;
    --radius-md:     10px;
    --radius-lg:     16px;
    --radius-xl:     24px;

    /* Transitions */
    --transition:    all 0.2s ease;
    --transition-slow: all 0.35s ease;
}

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

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ─── Links ─────────────────────────────────────────────── */
a {
    color: var(--accent);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--accent-hover);
}

/* ─── Headings ──────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

/* ─── Buttons ───────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.3rem;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--accent);
    color: var(--text-inverse);
    border-color: var(--accent);
    box-shadow: var(--shadow-sm), 0 0 12px var(--accent-glow);
}

.btn-primary:hover {
    background: var(--accent-hover);
    box-shadow: var(--shadow-md), 0 0 20px var(--accent-glow);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success);
    color: var(--text-inverse);
    border-color: var(--success);
}

.btn-success:hover {
    background: #00d1a0;
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.btn-danger:hover {
    background: #ff5f4f;
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border-color: var(--border);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(240, 165, 0, 0.05);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border-radius: var(--radius-lg);
}

/* ─── Form Elements ─────────────────────────────────────── */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 0.7rem 1rem;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: var(--transition);
    outline: none;
}

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

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

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

/* ─── Cards ─────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

/* ─── Flash Messages ────────────────────────────────────── */
.flash {
    padding: 0.85rem 1.2rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: slideIn 0.3s ease;
}

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

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

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

.flash-info {
    background: var(--info-bg);
    border: 1px solid var(--info-border);
    color: var(--info);
}

/* ─── Badges ────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 100px;
}

.badge-new      { background: var(--accent-glow); color: var(--accent); border: 1px solid var(--accent); }
.badge-approved { background: var(--success-bg); color: var(--success); border: 1px solid var(--success-border); }
.badge-denied   { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-border); }
.badge-handled  { background: rgba(255,255,255,0.08); color: var(--text-secondary); border: 1px solid var(--border); }

.badge-register { background: var(--info-bg); color: var(--info); }
.badge-passato  { background: var(--warning-bg); color: var(--warning); }
.badge-end      { background: var(--success-bg); color: var(--success); }
.badge-info     { background: rgba(255,255,255,0.08); color: var(--text-secondary); }

/* ─── Status dot ────────────────────────────────────────── */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.3rem;
}

.status-dot.active    { background: var(--warning); box-shadow: 0 0 6px var(--warning); }
.status-dot.completed { background: var(--success); box-shadow: 0 0 6px var(--success); }
.status-dot.problem   { background: var(--danger); box-shadow: 0 0 6px var(--danger); }
.status-dot.cancelled { background: var(--text-muted); }

/* ─── Notification pulse ────────────────────────────────── */
.notification-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--danger);
    color: white;
    border-radius: 100px;
}

.notification-badge.pulse::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 100px;
    border: 2px solid var(--danger);
    animation: pulse 1.5s ease infinite;
}

@keyframes pulse {
    0%   { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(1.5); }
}

/* ─── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

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

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

/* ─── Utility ───────────────────────────────────────────── */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted); }
.text-mono   { font-family: var(--font-mono); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.gap-1 { gap: 0.5rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ============================================================ */
/* Modals (Global Components)                                  */
/* ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.85); /* Increased opacity to compensate for lack of blur */
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}
.modal-overlay.hidden {
    display: none !important;
}
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin: 0;
}
.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.2rem;
    line-height: 1;
}
.modal-close:hover {
    color: var(--text-primary);
}
