/* ============================================================
   assets/css/style.css
   Viper Vision colour scheme — #F38A3F orange + #307DAB steel blue
   Dark sidebar, high-contrast cards, mobile-first.
   ============================================================ */

/* --- Google Fonts ----------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Barlow:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400&family=Barlow+Condensed:wght@600;700;800&display=swap');

/* --- CSS Custom Properties -------------------------------- */
:root {
    /* Brand colours */
    --orange:          #F38A3F;
    --orange-dark:     #d9722a;
    --orange-light:    #fef3ea;
    --blue:            #307DAB;
    --blue-dark:       #245f84;
    --blue-light:      #e8f4fa;

    /* Surface palette — dark sidebar, light main */
    --color-bg:        #f2f3f5;
    --color-surface:   #ffffff;
    --color-surface-2: #f7f8fa;
    --color-border:    #dde1e7;
    --color-text:      #1c2530;
    --color-text-muted:#5a6472;

    /* Semantic aliases */
    --color-primary:       var(--orange);
    --color-primary-hover: var(--orange-dark);
    --color-primary-light: var(--orange-light);
    --color-accent:        var(--blue);
    --color-accent-hover:  var(--blue-dark);
    --color-accent-light:  var(--blue-light);
    --color-danger:        #c0392b;
    --color-danger-light:  #fdf0ef;
    --color-success:       #1e8449;

    /* Severity colours */
    --sev-info:     #307DAB;
    --sev-low:      #1e8449;
    --sev-medium:   #d4ac0d;
    --sev-high:     #e67e22;
    --sev-critical: #c0392b;

    /* Layout */
    --sidebar-w:   265px;
    --topbar-h:    62px;
    --radius:      6px;
    --radius-lg:   10px;
    --shadow:      0 1px 4px rgba(0,0,0,0.10);
    --shadow-md:   0 4px 16px rgba(0,0,0,0.13);

    /* Typography */
    --font-body:    'Barlow', sans-serif;
    --font-display: 'Barlow Condensed', sans-serif;
}

/* --- Reset ------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font-body);
    font-size:   1rem;
    line-height: 1.6;
    color:       var(--color-text);
    background:  var(--color-bg);
    min-height:  100vh;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; color: var(--blue-dark); }
img, video { max-width: 100%; height: auto; border-radius: var(--radius); }

/* --- Typography ------------------------------------------- */
h1, h2, h3 {
    font-family:    var(--font-display);
    font-weight:    700;
    letter-spacing: .01em;
    line-height:    1.15;
}
h1 { font-size: 2rem;    color: var(--color-text); }
h2 { font-size: 1.45rem; color: var(--color-text); margin-bottom: .65rem; }
h3 { font-size: 1.1rem;  margin-bottom: .4rem; }
p  { margin-bottom: .75rem; }

/* --- Sidebar ---------------------------------------------- */
.sidebar {
    width:         var(--sidebar-w);
    background:    #1a2535;          /* dark navy */
    display:       flex;
    flex-direction: column;
    position:      fixed;
    top:           0; left: 0;
    height:        100vh;
    z-index:       200;
    transform:     translateX(-100%);
    transition:    transform .25s ease;
    overflow-y:    auto;
}
.sidebar.open { transform: translateX(0); }

/* Logo / branding strip — orange bar at top */
.sidebar-logo {
    padding:         1.1rem 1.4rem 1rem;
    background:      var(--orange);
    color:           #fff;
    font-family:     var(--font-display);
    font-size:       1.35rem;
    font-weight:     800;
    letter-spacing:  .04em;
    text-transform:  uppercase;
    line-height:     1.1;
}
.sidebar-logo span {
    display:      block;
    font-size:    .65rem;
    font-weight:  600;
    letter-spacing: .1em;
    text-transform: uppercase;
    opacity:      .8;
    margin-top:   .25rem;
    font-family:  var(--font-body);
}

.sidebar-nav { flex: 1; padding: .6rem 0; }

.sidebar-nav a {
    display:     flex;
    align-items: center;
    gap:         .6rem;
    padding:     .72rem 1.4rem;
    color:       rgba(255,255,255,.72);
    font-size:   .95rem;
    font-weight: 600;
    letter-spacing: .01em;
    transition:  background .15s, color .15s, border-left .15s;
    text-decoration: none;
    border-left: 3px solid transparent;
}
.sidebar-nav a:hover {
    background:  rgba(243,138,63,.12);
    color:       var(--orange);
    border-left-color: var(--orange);
}
.sidebar-nav a.active {
    background:  rgba(243,138,63,.18);
    color:       var(--orange);
    border-left-color: var(--orange);
}

.sidebar-footer {
    padding:     1rem 1.4rem;
    border-top:  1px solid rgba(255,255,255,.08);
    font-size:   .82rem;
}
.sidebar-footer a {
    color: rgba(255,255,255,.5);
    transition: color .15s;
}
.sidebar-footer a:hover { color: var(--orange); text-decoration: none; }

/* Overlay */
.sidebar-overlay {
    display:    none;
    position:   fixed;
    inset:      0;
    background: rgba(0,0,0,.5);
    z-index:    190;
}
.sidebar-overlay.show { display: block; }

/* --- Top bar ---------------------------------------------- */
.topbar {
    height:        var(--topbar-h);
    background:    var(--color-surface);
    border-bottom: 3px solid var(--orange);   /* orange accent line */
    display:       flex;
    align-items:   center;
    padding:       0 1.1rem;
    gap:           .75rem;
    position:      sticky;
    top:           0;
    z-index:       100;
    box-shadow:    0 2px 6px rgba(0,0,0,0.07);
}
.topbar-title {
    flex:         1;
    font-family:  var(--font-display);
    font-size:    1.15rem;
    font-weight:  700;
    color:        var(--color-text);
    letter-spacing: .02em;
    white-space:  nowrap;
    overflow:     hidden;
    text-overflow: ellipsis;
}
.menu-toggle {
    background: none;
    border:     none;
    cursor:     pointer;
    padding:    .4rem;
    color:      var(--color-text-muted);
    display:    flex;
    border-radius: var(--radius);
    transition: background .15s;
}
.menu-toggle:hover { background: var(--orange-light); color: var(--orange); }

/* --- Layout wrapper --------------------------------------- */
.page-wrapper { display: flex; min-height: 100vh; }
.main-content {
    flex:     1;
    padding:  1.25rem 1rem 3rem;
    max-width: 100%;
}

@media (min-width: 900px) {
    .sidebar { transform: translateX(0); }
    .sidebar-overlay { display: none !important; }
    .menu-toggle { display: none; }
    .page-wrapper { padding-left: var(--sidebar-w); }
    .main-content { padding: 1.75rem 2rem 3rem; max-width: 980px; }
}

/* --- Cards ------------------------------------------------ */
.card {
    background:    var(--color-surface);
    border:        1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding:       1.2rem;
    margin-bottom: 1rem;
    box-shadow:    var(--shadow);
}
.card-header {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    gap:             .5rem;
    margin-bottom:   .75rem;
    flex-wrap:       wrap;
}
.card-title {
    font-family:    var(--font-display);
    font-size:      1.05rem;
    font-weight:    700;
    color:          var(--color-text);
    letter-spacing: .01em;
}

/* Area card — blue left border */
.area-card { border-left: 4px solid var(--blue); }

/* Comment card */
.comment-card { border-left: 4px solid var(--color-border); margin-bottom: .75rem; }
.comment-card.sev-info     { border-color: var(--sev-info); }
.comment-card.sev-low      { border-color: var(--sev-low); }
.comment-card.sev-medium   { border-color: var(--sev-medium); }
.comment-card.sev-high     { border-color: var(--sev-high); }
.comment-card.sev-critical { border-color: var(--sev-critical); }

/* --- Severity badges -------------------------------------- */
.badge {
    display:        inline-block;
    padding:        .15rem .55rem;
    border-radius:  99px;
    font-size:      .7rem;
    font-weight:    700;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.badge-info     { background: var(--sev-info);     color: #fff; }
.badge-low      { background: var(--sev-low);      color: #fff; }
.badge-medium   { background: var(--sev-medium);   color: #1c2530; }
.badge-high     { background: var(--sev-high);     color: #fff; }
.badge-critical { background: var(--sev-critical); color: #fff; }

/* --- Buttons ---------------------------------------------- */
.btn {
    display:       inline-flex;
    align-items:   center;
    gap:           .4rem;
    padding:       .55rem 1.15rem;
    border:        none;
    border-radius: var(--radius);
    font-family:   var(--font-body);
    font-size:     .9rem;
    font-weight:   700;
    cursor:        pointer;
    transition:    background .15s, opacity .15s, transform .1s, box-shadow .15s;
    text-decoration: none;
    line-height:   1.3;
    white-space:   nowrap;
    letter-spacing: .01em;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Primary — orange */
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:hover { background: var(--orange-dark); box-shadow: 0 3px 10px rgba(243,138,63,.35); }

/* Accent — blue */
.btn-accent  { background: var(--blue); color: #fff; }
.btn-accent:hover { background: var(--blue-dark); box-shadow: 0 3px 10px rgba(48,125,171,.3); }

/* Outline — orange border */
.btn-outline {
    background: transparent;
    border:     2px solid var(--orange);
    color:      var(--orange);
}
.btn-outline:hover { background: var(--orange-light); }

/* Outline blue */
.btn-outline-blue {
    background: transparent;
    border:     2px solid var(--blue);
    color:      var(--blue);
}
.btn-outline-blue:hover { background: var(--blue-light); }

.btn-danger  { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #a93226; }

.btn-ghost {
    background: transparent;
    color:      var(--color-text-muted);
    padding:    .35rem .65rem;
}
.btn-ghost:hover { background: var(--color-surface-2); color: var(--color-text); }

.btn-sm { padding: .32rem .7rem; font-size: .82rem; }
.btn-lg { padding: .75rem 1.6rem; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }

/* --- Forms ------------------------------------------------ */
.form-group { margin-bottom: 1rem; }

label {
    display:        block;
    font-size:      .78rem;
    font-weight:    700;
    color:          var(--color-text-muted);
    margin-bottom:  .35rem;
    text-transform: uppercase;
    letter-spacing: .06em;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="email"],
input[type="number"],
select,
textarea {
    display:       block;
    width:         100%;
    padding:       .6rem .85rem;
    border:        1.5px solid var(--color-border);
    border-radius: var(--radius);
    font-family:   var(--font-body);
    font-size:     1rem;
    color:         var(--color-text);
    background:    var(--color-surface);
    transition:    border-color .15s, box-shadow .15s;
    -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
    outline:      none;
    border-color: var(--orange);
    box-shadow:   0 0 0 3px rgba(243,138,63,.18);
}
textarea { min-height: 76px; resize: vertical; }
select {
    background-image:    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M0 0l6 8 6-8z' fill='%235a6472'/%3E%3C/svg%3E");
    background-repeat:   no-repeat;
    background-position: right .75rem center;
    padding-right:       2.2rem;
}

.form-hint  { font-size: .8rem; color: var(--color-text-muted); margin-top: .25rem; }
.form-error { color: var(--color-danger); font-size: .85rem; margin-top: .25rem; }

.field-row { display: flex; gap: .5rem; align-items: flex-start; flex-wrap: wrap; }
.field-row > * { flex: 1 1 auto; min-width: 0; }
.field-row .btn { flex: 0 0 auto; }

/* --- File Upload Zone ------------------------------------- */
.upload-zone {
    border:        2px dashed var(--color-border);
    border-radius: var(--radius);
    padding:       1.25rem;
    text-align:    center;
    cursor:        pointer;
    color:         var(--color-text-muted);
    transition:    border-color .2s, background .2s;
    position:      relative;
}
.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--orange);
    background:   var(--orange-light);
    color:        var(--orange-dark);
}
.upload-zone input[type="file"] {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    opacity: 0; cursor: pointer;
}
.upload-zone-icon { font-size: 2rem; margin-bottom: .3rem; }
.upload-zone p    { margin: 0; font-size: .9rem; }

/* Media thumbnails */
.media-grid {
    display:               grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap:                   .5rem;
    margin-top:            .75rem;
}
.media-thumb {
    position:      relative;
    border-radius: var(--radius);
    overflow:      hidden;
    aspect-ratio:  1;
    background:    var(--color-surface-2);
    border:        1px solid var(--color-border);
}
.media-thumb img, .media-thumb video {
    width: 100%; height: 100%; object-fit: cover; border-radius: 0;
}
.media-thumb .remove-media {
    position:     absolute;
    top:          4px; right: 4px;
    width:        24px; height: 24px;
    background:   rgba(0,0,0,.65);
    color:        #fff;
    border:       none;
    border-radius: 50%;
    cursor:       pointer;
    font-size:    .9rem;
    line-height:  24px;
    text-align:   center;
    padding:      0;
}
.media-thumb .remove-media:hover { background: var(--color-danger); }
.media-thumb .video-badge {
    position:   absolute;
    bottom:     4px; left: 4px;
    background: rgba(48,125,171,.85);
    color:      #fff;
    font-size:  .62rem;
    padding:    1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: .06em;
}

/* --- Alerts ----------------------------------------------- */
.alert {
    padding:       .85rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-size:     .92rem;
    font-weight:   500;
    border-left:   4px solid transparent;
}
.alert-success {
    background:   #eafaf1;
    border-color: var(--color-success);
    color:        #145a32;
}
.alert-error {
    background:   var(--color-danger-light);
    border-color: var(--color-danger);
    color:        var(--color-danger);
}
.alert-info {
    background:   var(--blue-light);
    border-color: var(--blue);
    color:        var(--blue-dark);
}

/* --- Tables ----------------------------------------------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td {
    padding: .65rem .9rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}
th {
    font-size:      .75rem;
    text-transform: uppercase;
    letter-spacing: .07em;
    font-weight:    700;
    color:          var(--color-text-muted);
    background:     var(--color-surface-2);
    border-bottom:  2px solid var(--orange);
}
tr:hover td { background: #fef9f5; }
.td-actions { white-space: nowrap; text-align: right; }

/* --- Login page ------------------------------------------- */
.login-wrap {
    min-height:      100vh;
    display:         flex;
    align-items:     center;
    justify-content: center;
    background:      #1a2535;
    padding:         1rem;
    /* subtle diagonal stripe texture */
    background-image: repeating-linear-gradient(
        135deg,
        rgba(255,255,255,.015) 0px,
        rgba(255,255,255,.015) 1px,
        transparent 1px,
        transparent 12px
    );
}
.login-card {
    width:         100%;
    max-width:     400px;
    background:    var(--color-surface);
    border-radius: var(--radius-lg);
    overflow:      hidden;
    box-shadow:    0 8px 40px rgba(0,0,0,.35);
}
/* Orange header strip on login card */
.login-logo {
    background:   var(--orange);
    padding:      2rem 1.75rem 1.6rem;
    text-align:   center;
    color:        #fff;
}
.login-logo h1 {
    font-family:    var(--font-display);
    font-size:      2.1rem;
    font-weight:    800;
    letter-spacing: .05em;
    text-transform: uppercase;
    color:          #fff;
    line-height:    1;
}
.login-logo p {
    font-size:   .82rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    opacity:     .85;
    margin:      .4rem 0 0;
}
.login-form-body { padding: 1.75rem; }

/* --- Dashboard -------------------------------------------- */
.dashboard-grid {
    display:               grid;
    gap:                   1rem;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    margin-top:            1.25rem;
}
.dashboard-card {
    background:    var(--color-surface);
    border:        1px solid var(--color-border);
    border-radius: var(--radius-lg);
    border-top:    4px solid var(--orange);
    padding:       1.5rem 1.25rem;
    text-align:    center;
    cursor:        pointer;
    transition:    box-shadow .15s, transform .15s, border-top-color .15s;
    text-decoration: none;
    color:         inherit;
    display:       block;
}
.dashboard-card:hover {
    box-shadow:       var(--shadow-md);
    transform:        translateY(-3px);
    border-top-color: var(--blue);
    text-decoration:  none;
}
.dashboard-card-icon  { font-size: 2.2rem; margin-bottom: .5rem; }
.dashboard-card-label {
    font-family:    var(--font-display);
    font-weight:    700;
    font-size:      1rem;
    color:          var(--color-text);
    letter-spacing: .02em;
}
.dashboard-card-sub { font-size: .8rem; color: var(--color-text-muted); margin-top: .2rem; }

/* --- Utilities -------------------------------------------- */
.text-muted { color: var(--color-text-muted); }
.text-sm    { font-size: .85rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-1 { gap: .5rem; }
.flex-wrap { flex-wrap: wrap; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.hidden { display: none; }
.divider { border: none; border-top: 1px solid var(--color-border); margin: 1rem 0; }

/* Collapse */
.area-body.collapsed { display: none; }

/* --- Public report (report_view.php) ---------------------- */
.report-header {
    background:    #fff;
    color:         #000;
    padding:       2rem 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 4px solid var(--orange);
}
.report-header h1 { color: #000; font-size: 1.7rem; margin-bottom: .3rem; }
.report-meta { font-size: .9rem; opacity: .82; line-height: 1.9; }
.report-summary {
    background:   var(--orange-light);
    border-left:  4px solid var(--orange);
    padding:      1rem 1.25rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-bottom: 1.5rem;
    font-style:   italic;
    color:        #000  /*  var(--color-text);  */
}
.area-heading {
    border-bottom: 3px solid var(--blue);
    padding-bottom: .4rem;
    margin:        2rem 0 1rem;
    color:         var(--blue-dark);
    font-family:   var(--font-display);
    font-size:     1.3rem;
    font-weight:   700;
    letter-spacing: .02em;
    text-transform: uppercase;
}
.comment-view {
    border-left:   4px solid var(--color-border);
    padding:       .85rem 1rem;
    margin-bottom: .85rem;
    background:    var(--color-surface);
    border-radius: 0 var(--radius) var(--radius) 0;
}
.comment-view.sev-info     { border-color: var(--sev-info); }
.comment-view.sev-low      { border-color: var(--sev-low); }
.comment-view.sev-medium   { border-color: var(--sev-medium); }
.comment-view.sev-high     { border-color: var(--sev-high); }
.comment-view.sev-critical { border-color: var(--sev-critical); }
.comment-title { font-weight: 700; font-size: 1rem; margin-bottom: .35rem; }
.comment-notes { color: var(--color-text); line-height: 1.65; white-space: pre-wrap; }
.report-footer {
    margin-top:  3rem;
    padding-top: 1rem;
    border-top:  1px solid var(--color-border);
    font-size:   .8rem;
    color:       var(--color-text-muted);
    text-align:  center;
}

/* --- Print ------------------------------------------------ */
@media print {
    .sidebar, .topbar, .btn, .upload-zone, .no-print { display: none !important; }
    .page-wrapper { padding-left: 0; }
    .card { box-shadow: none; border: 1px solid #ccc; page-break-inside: avoid; }
    .report-header { background: #000 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
