/* Fonts */
@font-face {
    font-family: 'Fonarto';
    src: url('../fonts/Fonarto.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Isidora';
    src: url('../fonts/Isidora.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Gibed';
    src: url('../fonts/gibed.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Quizlo';
    src: url('../fonts/Quizlo.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
}

:root {
    /* Emerald Design System */
    --emerald-deep: #085D36;
    --emerald-royal: #004B3B;
    --emerald-main: #097969;
    --emerald-light: #50C878;
    --emerald-accent: #097969;
    --royal-crimson: #940128;

    /* Fonts */
    --font-nature: 'Isidora', sans-serif;
    --font-gibed: 'Gibed', sans-serif;
    --font-quizlo: 'Quizlo', sans-serif;
    --font-fonarto: 'Fonarto', sans-serif;

    /* Updated Colors for High Contrast */
    --primary: var(--emerald-light);
    /* Brighter Green for Pop */
    --secondary: var(--emerald-royal);
    --accent: var(--emerald-light);
    --bg: #020c08;
    /* Deeper dark background */
    --card-bg: rgba(0, 75, 59, 0.15);
    /* Slightly clearer background */
    --text: #f0fff4;
    --text-dim: #b8e0c6;
    /* Brighter dim text for readability */
    --border: rgba(80, 200, 120, 0.3);
    /* Greenish border for definition */
    --gradient: linear-gradient(135deg, var(--emerald-light) 0%, var(--emerald-main) 100%);
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    --glass: rgba(255, 255, 255, 0.05);

    /* Feedback Colors */
    --success: #2ecc71;
    --warning: #f1c40f;
    --danger: #e74c3c;
    --info: #3498db;
}

* {
    box-sizing: border-box;
    font-family: var(--font-nature);
}

body {
    background-color: var(--bg);
    background-image:
        radial-gradient(at 0% 0%, rgba(9, 121, 105, 0.15) 0, transparent 50%),
        radial-gradient(at 100% 100%, rgba(0, 75, 59, 0.15) 0, transparent 50%);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    overflow-y: auto !important;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

/* Hide scrollbar for all browsers */
body::-webkit-scrollbar {
    display: none;
}

body {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

html {
    overflow-y: auto !important;
    overflow-x: hidden;
}

html::-webkit-scrollbar {
    display: none;
}

html {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* Header Styles */
/* =============================================
   FIXED HEADER LAYOUT - DESKTOP & MOBILE
   ============================================= */

.header-main {
    display: grid !important;
    grid-template-columns: minmax(40px, auto) 1fr minmax(40px, auto) !important;
    align-items: center !important;
    gap: 2rem !important;
    padding-top: 1rem !important;
    margin-bottom: 3rem !important;
    position: relative !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1.5rem !important;
}

.back-button-container {
    justify-self: start !important;
    flex: none !important;
    min-width: auto !important;
    display: flex;
    align-items: center;
}

.header-content {
    text-align: center !important;
    justify-self: center !important;
    flex: none !important;
    flex-grow: 1 !important;
}

.user-profile-container {
    justify-self: end !important;
    flex: none !important;
    min-width: auto !important;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

/* Reduce top padding on mobile and tablet */
@media (max-width: 991px) {
    .header-main {
        padding-top: 0.5rem !important;
    }
}

@media (max-width: 767px) {
    .header-main {
        padding-top: 0.25rem !important;
    }
}

@media (max-width: 480px) {
    .header-main {
        padding-top: 0 !important;
    }
}

.header-content {
    text-align: center;
    flex-grow: 1;
}

.back-button-container,
.user-profile-container {
    flex: 0 0 clamp(100px, 15vw, 160px);
    width: clamp(100px, 15vw, 160px);
}

/* Hide back button */
.back-button-container {
    visibility: hidden;
    pointer-events: none;
}

.user-profile-container {
    display: flex;
    justify-content: flex-end;
}

/* Elite Button Styling */
.back-btn {
    text-decoration: none !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 10px !important;
    font-weight: 700 !important;
    padding: clamp(8px, 1.5vw, 12px) clamp(16px, 2.4vw, 24px) !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1) !important;
    font-size: clamp(0.7rem, 2vw, 0.9rem) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
}

.back-btn:hover {
    background: rgba(148, 1, 40, 0.15) !important;
    transform: translateY(-3px) !important;
    border-color: var(--royal-crimson) !important;
    box-shadow: 0 12px 25px rgba(148, 1, 40, 0.3) !important;
    color: #ffffff !important;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-gibed);
    font-weight: normal;
    letter-spacing: 1px;
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    margin-top: 0;
    letter-spacing: -0.02em;
    font-size: clamp(1.2rem, 3vw, 1.6rem);
}

/* UI Utilities */
.font-14-pink {
    font-size: 1.1rem;
    font-weight: 700;
    color: #d63384 !important;
    -webkit-text-fill-color: initial !important;
    background: none !important;
    letter-spacing: 0.5px;
}

.font-14-green {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary) !important;
    -webkit-text-fill-color: initial !important;
    background: none !important;
    letter-spacing: 0.5px;
}

.header-main h1 {
    font-family: var(--font-gibed);
    color: var(--emerald-light);
    text-shadow: 0 0 20px rgba(80, 200, 120, 0.3);
    font-size: clamp(0.8rem, 2vw, 1.6rem);
    /* Same as akira-hub.html */
}

p.subtitle {
    color: var(--text-dim);
    font-size: clamp(0.75rem, 1.5vw, 0.95rem);
    /* Tighter scaling */
    max-width: 100%;
    margin: 0 auto;
    font-style: italic;
    opacity: 0.8;
}

/* Container & Grid */
.container-fluid,
.container {
    max-width: 1400px !important;
    padding: 1.2rem clamp(1rem, 2vw, 1.5rem) !important;
    /* Consistent top padding */
    flex: 1;
    margin: 0 auto !important;
    /* Center on large screens */
    width: 100% !important;
}

.container-padding {
    padding: 1.2rem clamp(1rem, 2vw, 1.5rem) !important;
}

/* Sidebar Navigation */
.sidebar-nav {
    position: sticky;
    top: 2rem;
    z-index: 100;
}

.nav-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(80, 200, 120, 0.1);
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.nav-box i {
    width: 32px;
    height: 32px;
    background: var(--emerald-main);
    color: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.nav-box:hover {
    background: rgba(255, 255, 255, 0.07);
    transform: translateX(8px) translateY(-2px);
    border-color: var(--primary);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.nav-box.active {
    background: rgba(9, 121, 105, 0.1);
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(9, 121, 105, 0.15);
}

.nav-box.active i {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(9, 121, 105, 0.3);
}

.nav-box span {
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.01em;
}

/* Calculator Cards */
.calc-card {
    background: rgba(0, 30, 20, 0.4);
    border-radius: 16px;
    padding: clamp(16px, 3vw, 24px);
    /* Reduced padding */
    border: 1px solid rgba(80, 200, 120, 0.1);
    height: 100%;
    transition: all 0.4s ease;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow);
}

.calc-card:hover {
    border-color: rgba(9, 121, 105, 0.3);
}

.calc-card h4 {
    color: var(--emerald-light);
    font-size: 1.05rem;
    /* Slightly smaller */
    margin-bottom: 16px;
    /* Reduced margin */
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    opacity: 0.9;
}

/* Form Elements */
.form-label {
    color: var(--text-dim);
    font-size: 0.8rem;
    /* Slightly smaller */
    margin-bottom: 5px;
    /* Reduced margin */
    display: block;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.8;
}

.calc-input,
.calc-select {
    width: 100%;
    background-color: rgba(0, 0, 0, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 8px;
    color: #fff !important;
    padding: 10px 14px !important;
    font-size: 0.92rem;
    font-weight: 400;
    outline: none;
    transition: all 0.2s ease;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

select.calc-input,
select.calc-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 16px !important;
    padding-right: 36px !important;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

/* Ensure options are visible and have contrast */
.calc-input option,
.calc-select option,
select option {
    background-color: #0d1e18 !important;
    /* Deep emerald-tinted black */
    color: #ffffff !important;
    font-weight: 500;
    padding: 10px;
}

.calc-input:focus,
.calc-select:focus {
    background-color: rgba(255, 255, 255, 0.08) !important;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(9, 121, 105, 0.15), inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.calc-input::placeholder {
    color: rgba(255, 255, 255, 0.2);
}

/* Metric/List Box Styling */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* Strict 4 columns on desktop */
    gap: 15px 30px;
    margin: 20px 0;
}

.metrics-grid .extra-row {
    padding: 0;
    background: transparent;
    border-radius: 0;
    transition: all 0.2s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.metrics-grid .extra-row:hover {
    background: transparent;
    transform: none;
    box-shadow: none;
}

/* Custom Checkbox Style */
.metric-chk {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.metric-chk:checked {
    background: var(--primary);
    border-color: var(--primary);
}

.metric-chk:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 4px;
    height: 8px;
    border: solid #000;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.metrics-grid label,
.extra-row label {
    font-size: 0.95rem;
    /* Clean fixed size */
    font-weight: 500;
    margin-left: 12px;
    color: #fff;
    vertical-align: middle;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.metrics-grid .extra-row:hover label {
    color: var(--emerald-light);
    opacity: 1;
}

/* Elite Buttons */
.calc-btn,
.btn-elite,
.btn-pink-gradient {
    width: 100%;
    background: #06694d;
    border: none;
    padding: 10px 20px;
    /* More compact */
    border-radius: 10px;
    color: #fff;
    font-weight: 600;
    margin-top: 12px;
    /* Reduced margin */
    transition: all 0.3s ease;
    cursor: pointer;
    display: block;
    font-size: 0.95rem;
    letter-spacing: 0.01em;
}

.calc-btn:hover,
.btn-elite:hover {
    background: #08805d;
    transform: translateY(-1px);
}

.calc-btn:hover,
.btn-pink-gradient:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(9, 121, 105, 0.35);
    filter: brightness(1.1);
}

.calc-btn:active,
.btn-pink-gradient:active {
    transform: translateY(-1px);
}

/* Results Section */
.result-box,
.result-card {
    background: rgba(9, 121, 105, 0.1);
    padding: 30px;
    border-radius: 20px;
    border: 1px solid rgba(9, 121, 105, 0.2);
    border-left: 6px solid var(--primary);
    margin-top: 25px;
    transition: all 0.4s ease;
}

.result-label {
    font-size: 0.85rem;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.result-val,
.result-value {
    font-size: 2.2rem;
    color: #fff !important;
    font-weight: 700;
    line-height: 1;
}

/* Premium Table Layouts */
.table-container {
    width: 100%;
    overflow-x: auto;
    margin-top: 10px;
}

.table-akira {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
    color: var(--text);
    border-radius: 8px;
    overflow: hidden;
}

.table-akira th {
    text-align: left;
    padding: 12px 16px;
    font-weight: 700;
    color: #fff;
    background: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.75rem;
}

.table-akira td {
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

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

.table-akira tr:hover td {
    background: rgba(255, 255, 255, 0.04);
}

/* Sparklines */
.spark-container {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 20px;
    vertical-align: middle;
}

.spark-bar {
    width: 4px;
    background: var(--primary);
    border-radius: 1px;
}

/* Upload Area Styling Refinement */
.upload-area {
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    background: rgba(0, 20, 15, 0.2);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    max-width: 280px;
    margin-bottom: 25px;
}

.upload-area i {
    font-size: 2.8rem;
    color: #ffc107;
}

.upload-area p {
    font-size: 1rem;
    font-weight: 500;
    color: #fff;
    margin: 0;
}

.upload-area span {
    font-size: 0.85rem;
    color: var(--text-dim);
    opacity: 0.7;
}

.hidden-file-input {
    display: none !important;
}

.hidden-calc {
    display: none !important;
}

/* BiTable/Mini buttons */
.btn-mini {
    padding: 6px 14px;
    font-size: 0.85rem;
    border-radius: 8px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-mini-green {
    background: rgba(9, 121, 105, 0.2);
    color: var(--emerald-light);
    border: 1px solid rgba(80, 200, 120, 0.2);
}

.btn-mini-green:hover {
    background: var(--emerald-main);
    color: white;
}

.btn-mini-pink {
    background: rgba(148, 1, 40, 0.1);
    color: #ff6b6b;
    border: 1px solid rgba(255, 107, 107, 0.2);
}

.btn-mini-pink:hover {
    background: var(--royal-crimson);
    color: white;
}

.status-pill {
    margin-left: auto;
    background: rgba(255, 193, 7, 0.1);
    color: #ffc107;
    font-size: 8px !important;
    padding: 2px 6px !important;
    border-radius: 10px;
    border: 1px solid rgba(255, 193, 7, 0.2);
    font-weight: 700 !important;
    text-transform: uppercase;
}

/* ===== DESKTOP TWO-COLUMN LAYOUT ===== */
@media (min-width: 1024px) {
    .row {
        display: flex;
        gap: clamp(20px, 4vw, 40px);
    }

    .col-lg-3 {
        flex: 0 0 clamp(280px, 25vw, 340px);
        max-width: clamp(280px, 25vw, 340px);
    }

    .col-lg-9 {
        flex: 1;
        min-height: 500px;
        position: relative;
    }

    .col-lg-9.empty-state::before {
        content: "Select a specialized tool from the list";
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100%;
        color: rgba(255, 255, 255, 0.03);
        font-size: 2rem;
        font-weight: 800;
        text-align: center;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        pointer-events: none;
        z-index: 0;
    }

    .col-lg-9.empty-state .calc-section {
        position: relative;
        z-index: 1;
    }
}

/* Header & Mobile Optimizations */
@media (max-width: 991px) {
    .header-main {
        display: flex !important;
        flex-wrap: wrap !important;
        flex-direction: row !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 0.75rem !important;
        padding-top: 0 !important;
        padding-bottom: 2rem !important;
    }

    .back-button-container,
    .user-profile-container {
        order: 0 !important;
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: auto !important;
        justify-content: initial !important;
    }

    .header-content {
        order: 1 !important;
        flex: 0 0 100% !important;
        width: 100% !important;
        text-align: center !important;
        margin-top: 0.5rem !important;
    }

    /* Scaling down Elite Buttons */
    .back-btn {
        padding: 8px 16px !important;
        font-size: 0.8rem !important;
        border-radius: 10px !important;
        gap: 6px !important;
    }

    /* Scaling down User Icon */
    .user-profile #user-menu-toggle {
        width: 38px !important;
        height: 38px !important;
        border-radius: 10px !important;
    }

    .calc-card {
        padding: 25px;
    }
}


@media (max-width: 480px) {
    .header-main {
        margin-bottom: 0.6rem !important;
        padding-top: 0 !important;
    }

    .back-btn {
        padding: 6px 12px !important;
        font-size: 0.75rem !important;
    }
}


/* User Profile & Dropdown */
.user-profile #user-menu-toggle {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--glass);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.user-profile #user-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-2px);
}