/* =============================================================
   PROFESSIONAL ENTERPRISE THEME
   Inspired by Document360, BizTalk360, Turbo360
   ============================================================= */

/* === DARK THEME (Default) === */
:root {
    --bg-dark: #0f1720;
    --bg-card: #1a2535;
    --bg-input: #1e2d3e;

    --primary: #4a8fe0;
    --primary-hover: #5fa3ee;
    --primary-glow: rgba(74, 143, 224, 0.15);

    --secondary: #8b6cf7;
    --secondary-hover: #9f84f8;
    --secondary-glow: rgba(139, 108, 247, 0.15);

    --accent-red: #e05c5c;
    --accent-green: #3abf7a;
    --accent-yellow: #e8a83a;
    --accent-orange: #e87a3a;

    --text-main: #d8e4f0;
    --text-muted: #7a8fa8;
    --text-danger: #e05c5c;
    --warning: #e8a83a;

    --border-color: #243244;
    --glass-border: rgba(255, 255, 255, 0.05);
    --bg-badge: #1e2d3e;
    --bg-hover: rgba(74, 143, 224, 0.07);

    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;

    --shadow-sm: 0 1px 6px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 18px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 36px rgba(0, 0, 0, 0.55);

    --nav-bg: #111927;
    --nav-border: #1e2d3e;
}

/* === LIGHT THEME === */
[data-theme="light"] {
    --bg-dark: #eef2f8;
    --bg-card: #ffffff;
    --bg-input: #f7f9fc;

    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-glow: rgba(37, 99, 235, 0.12);

    --secondary: #7c3aed;
    --secondary-hover: #6d28d9;
    --secondary-glow: rgba(124, 58, 237, 0.12);

    --accent-red: #dc2626;
    --accent-green: #059669;
    --accent-yellow: #d97706;
    --accent-orange: #ea580c;

    --text-main: #1e2d40;
    --text-muted: #4f6278;
    --text-danger: #dc2626;
    --warning: #d97706;

    --border-color: #dce5f0;
    --glass-border: rgba(0, 0, 0, 0.05);
    --bg-badge: #e8eef6;
    --bg-hover: rgba(37, 99, 235, 0.05);

    --shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.07);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.14);

    --nav-bg: #ffffff;
    --nav-border: #dce5f0;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-main);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.3px;
    margin-bottom: 1rem;
    color: var(--text-main);
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.15s ease;
}

/* ===================== NAVBAR ===================== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--nav-bg);
    border-bottom: 1px solid var(--nav-border);
    box-shadow: var(--shadow-sm);
}

.navbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    height: 62px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand {
    font-size: 1.25rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
    margin: 0 1rem;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.42rem 0.95rem;
    border-radius: var(--radius-sm);
    font-size: 0.865rem;
    font-weight: 500;
    color: var(--text-muted);
    border: 1px solid transparent;
    transition: all 0.15s ease;
    white-space: nowrap;
    cursor: pointer;
    background: none;
    font-family: var(--font-main);
}

.nav-btn:hover {
    color: var(--primary);
    background: var(--bg-hover);
    border-color: var(--primary-glow);
}

.nav-btn.active {
    color: var(--primary);
    background: var(--primary-glow);
    border-color: rgba(74, 143, 224, 0.28);
    font-weight: 600;
}

[data-theme="light"] .nav-btn.active {
    border-color: rgba(37, 99, 235, 0.22);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
}

/* ===================== THEME TOGGLE ===================== */
.theme-toggle {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.theme-toggle:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--bg-hover);
}

/* ===================== PROFILE DROPDOWN ===================== */
.profile-dropdown-wrapper {
    position: relative;
}

.profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 700;
    border: 2px solid transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: 0.5px;
    transition: all 0.2s ease;
    flex-shrink: 0;
    font-family: var(--font-main);
}

.profile-avatar:hover {
    box-shadow: 0 0 0 3px var(--primary-glow);
    transform: scale(1.06);
}

.profile-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 10px);
    width: 268px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    overflow: hidden;
}

.profile-dropdown.open {
    display: block;
    animation: dropdownIn 0.15s ease-out;
}

@keyframes dropdownIn {
    from { opacity: 0; transform: translateY(-6px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.profile-dropdown-header {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1rem 1rem;
}

.profile-avatar-lg {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    letter-spacing: 0.5px;
}

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

.profile-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-role {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--primary);
    margin-top: 1px;
}

.profile-email {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-dropdown-divider {
    height: 1px;
    background: var(--border-color);
}

.profile-name-form {
    display: flex;
    gap: 0.5rem;
    padding: 0.65rem 0.875rem;
    align-items: center;
}

.profile-name-input {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.6rem;
    font-size: 0.8rem;
    color: var(--text-main);
    font-family: var(--font-main);
    transition: border-color 0.2s;
    min-width: 0;
}

.profile-name-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

.profile-name-input::placeholder { color: var(--text-muted); }

.profile-name-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
    font-family: var(--font-main);
}

.profile-name-btn:hover { background: var(--primary-hover); }

.profile-dropdown-section {
    padding: 0.35rem 0;
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 1rem;
    font-size: 0.875rem;
    color: var(--text-main);
    transition: background 0.12s;
    cursor: pointer;
}

.profile-dropdown-item:hover {
    background: var(--bg-hover);
    color: var(--primary);
}

.profile-dropdown-item-danger { color: var(--accent-red); }
.profile-dropdown-item-danger:hover {
    background: rgba(224, 92, 92, 0.07);
    color: var(--accent-red);
}

[data-theme="light"] .profile-dropdown-item-danger:hover {
    background: rgba(220, 38, 38, 0.06);
}

/* ===================== PAGE WRAPPER ===================== */
.page-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem 2rem 2rem;
}

/* Legacy .container alias used by inner page templates */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ===================== CARDS ===================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md), 0 0 0 1px var(--primary-glow);
}

/* ===================== BUTTONS ===================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.52rem 1.15rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.18s ease;
    font-family: var(--font-main);
    white-space: nowrap;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: var(--shadow-md);
}

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

.btn-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--bg-hover);
}

.btn-accent {
    background: var(--secondary);
    color: #fff;
    border-color: var(--secondary);
    box-shadow: var(--shadow-sm);
}

.btn-accent:hover {
    background: var(--secondary-hover);
    border-color: var(--secondary-hover);
    box-shadow: var(--shadow-md);
}

.btn-danger {
    background: rgba(224, 92, 92, 0.1);
    color: var(--accent-red);
    border-color: var(--accent-red);
}

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

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

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--bg-hover);
}

/* ===================== INPUTS ===================== */
.form-group { margin-bottom: 1.5rem; }

label {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

input[type="text"],
input[type="url"],
input[type="password"],
input[type="email"],
textarea,
select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    padding: 0.72rem 0.95rem;
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font-family: var(--font-main);
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

input::placeholder,
textarea::placeholder { color: var(--text-muted); opacity: 0.8; }

/* ===================== BADGES ===================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    background: var(--bg-badge);
    border-radius: 4px;
    font-size: 0.72rem;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-main);
    border: 1px solid transparent;
}

.badge-status {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: currentColor;
    margin-right: 4px;
    vertical-align: middle;
    margin-top: -1px;
}

.badge-critical {
    background: rgba(224, 92, 92, 0.12);
    color: var(--accent-red);
    border-color: rgba(224, 92, 92, 0.32);
}

.badge-high {
    background: rgba(232, 122, 58, 0.12);
    color: var(--accent-orange);
    border-color: rgba(232, 122, 58, 0.32);
}

.badge-medium {
    background: rgba(232, 168, 58, 0.12);
    color: var(--accent-yellow);
    border-color: rgba(232, 168, 58, 0.32);
}

.badge-low {
    background: rgba(58, 191, 122, 0.12);
    color: var(--accent-green);
    border-color: rgba(58, 191, 122, 0.32);
}

.badge-info {
    background: var(--primary-glow);
    color: var(--primary);
    border-color: rgba(74, 143, 224, 0.28);
}

/* ===================== FLASH MESSAGES ===================== */
.flash-messages {
    position: fixed;
    top: 1.25rem;
    right: 1.5rem;
    z-index: 999;
    max-width: 340px;
}

.flash {
    background: var(--bg-card);
    border-left: 4px solid var(--primary);
    padding: 0.85rem 1.2rem;
    margin-bottom: 0.65rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.25s ease-out;
    display: flex;
    align-items: center;
    color: var(--text-main);
    font-size: 0.875rem;
    transition: opacity 0.3s;
}

.flash.success { border-color: var(--accent-green); }
.flash.danger  { border-color: var(--accent-red); }
.flash.warning { border-color: var(--accent-yellow); }
.flash.info    { border-color: var(--primary); }

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

/* ===================== TABLES ===================== */
.table-container { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    font-size: 0.875rem;
}

th {
    text-align: left;
    padding: 0.85rem 1rem;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.775rem;
    letter-spacing: 0.6px;
    text-transform: uppercase;
}

td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: top;
    color: var(--text-main);
}

tr:hover td { background: var(--bg-hover); }

/* ===================== UTILITY ===================== */
.text-mono   { font-family: var(--font-mono); }
.text-right  { text-align: right; }
.text-muted  { color: var(--text-muted); }
.text-danger { color: var(--accent-red); }

.flex         { display: flex; gap: 1rem; align-items: center; }
.flex-between { justify-content: space-between; }

.grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    align-items: stretch;
}

.stat-item  { text-align: center; }

.stat-value {
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--text-main);
}

.stat-label {
    color: var(--text-muted);
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 1px;
}

/* ===================== FINDINGS ===================== */
.finding-group {
    margin-bottom: 1.25rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    overflow: hidden;
    transition: border-color 0.2s ease;
}

.finding-header-row {
    padding: 0.875rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.12s;
}

.finding-header-row:hover { background: var(--bg-hover); }

.finding-header-row.active {
    border-bottom: 1px solid var(--border-color);
}

.finding-title {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.toggle-icon {
    font-size: 0.75rem;
    transition: transform 0.22s ease;
    color: var(--text-muted);
}

.finding-header-row.active .toggle-icon { transform: rotate(180deg); }

.finding-body-container { display: none; }

.finding-body-container.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

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

.desc-section { margin-bottom: 1rem; }
.desc-section:last-child { margin-bottom: 0; }

.desc-label {
    display: block;
    font-size: 0.7rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
    letter-spacing: 0.5px;
}

.desc-text {
    font-size: 0.875rem;
    line-height: 1.65;
    color: var(--text-main);
}

.desc-evidence {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    color: var(--text-muted);
}

.desc-evidence ul { list-style: none; padding: 0; }
.desc-evidence li {
    padding: 2px 0;
    border-bottom: 1px solid var(--glass-border);
}
.desc-evidence li:last-child { border-bottom: none; }

.desc-remediation {
    background: rgba(58, 191, 122, 0.06);
    border-left: 3px solid var(--accent-green);
    padding: 0.75rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--text-main);
    font-size: 0.875rem;
}

/* Severity accent borders */
.finding-group.critical { border-left: 4px solid var(--accent-red);    }
.finding-group.high     { border-left: 4px solid var(--accent-orange);  }
.finding-group.medium   { border-left: 4px solid var(--accent-yellow);  }
.finding-group.low      { border-left: 4px solid var(--accent-green);   }
.finding-group.info     { border-left: 4px solid var(--primary);        }

/* ===================== FOOTER ===================== */
footer {
    margin-top: 3.5rem;
    padding: 1.5rem 0;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.78rem;
    letter-spacing: 0.3px;
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
    .navbar-inner { padding: 0 1rem; }
    .nav-links { display: none; }
    .page-wrapper { padding: 1.5rem 1rem; }
}
