/* ===== Hellfire Customs – Main Stylesheet ===== */
/* Base styles, CSS custom properties, typography, animations */

:root {
    /* Accent color – overridden dynamically by theme.js */
    --accent: #ff4500;
    --accent-glow: rgba(255, 69, 0, 0.4);
    --accent-soft: rgba(255, 69, 0, 0.15);

    /* Dark theme palette */
    --bg-dark: #0a0a0f;
    --bg-card: rgba(18, 18, 28, 0.85);
    --bg-card-solid: #12121c;
    --bg-input: rgba(255, 255, 255, 0.05);
    --bg-hover: rgba(255, 255, 255, 0.08);
    --border: rgba(255, 255, 255, 0.08);
    --border-focus: var(--accent);

    /* Text */
    --text: #e8e8f0;
    --text-muted: #8888a0;
    --text-dim: #555570;

    /* Status */
    --success: #22c55e;
    --error: #ef4444;
    --warning: #f59e0b;

    /* Spacing */
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 20px;

    /* Transition */
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== Reset & Base ===== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Outfit', system-ui, -apple-system, sans-serif;
    background: var(--bg-dark);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--text);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ===== Glass Card ===== */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

/* ===== Top Navigation ===== */
.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    background: rgba(10, 10, 15, 0.9);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-logo-wrap {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
}

.nav-logo {
    width: 36px;
    height: 36px;
    filter: drop-shadow(0 0 8px var(--accent-glow));
    animation: flamePulse 2s ease-in-out infinite;
}

.nav-title {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--text);
}

.nav-title-sub {
    font-weight: 300;
    letter-spacing: 4px;
    font-size: 0.75em;
    color: var(--text-muted);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-greeting {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.nav-link {
    font-size: 0.85rem;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: all var(--transition);
    border: 1px solid transparent;
}

.nav-link:hover {
    color: var(--text);
    background: var(--bg-hover);
    border-color: var(--border);
}

.nav-logout {
    color: var(--error);
}

.nav-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--error);
}

/* ===== Page Header ===== */
.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: 1px;
    background: linear-gradient(135deg, var(--text) 0%, var(--accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-top: 4px;
}

/* ===== Buttons ===== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary svg {
    width: 18px;
    height: 18px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px var(--accent-glow);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--bg-input);
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    color: var(--text);
    border-color: rgba(255, 255, 255, 0.15);
}

/* ===== Form Elements ===== */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    transition: all var(--transition);
    outline: none;
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    background: rgba(255, 255, 255, 0.08);
}

.form-input::placeholder {
    color: var(--text-dim);
}

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238888a0' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

/* ===== Premium Styled Select ===== */
.form-select {
    width: 100%;
    padding: 14px 44px 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    transition: all var(--transition);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23ff4500' stroke-width='2.5' stroke-linecap='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
}

.form-select:hover {
    border-color: rgba(255, 255, 255, 0.15);
    background-color: var(--bg-hover);
}

.form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft), 0 4px 20px rgba(0, 0, 0, 0.2);
    background-color: rgba(255, 255, 255, 0.08);
}

.form-select option {
    background: var(--bg-card-solid);
    color: var(--text);
    padding: 12px 16px;
    font-size: 0.9rem;
}

.form-select option:checked {
    background: var(--accent);
    color: #fff;
}

.form-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

.form-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-top: 4px;
}

.form-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--error);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-top: 12px;
    animation: shakeX 0.4s ease-in-out;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
}

.checkbox-group label {
    margin-bottom: 0;
    cursor: pointer;
    font-size: 0.88rem;
    color: var(--text);
}

/* ===== Loading Spinner ===== */
.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 40px auto;
}

/* ===== Toast Notifications ===== */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    color: #fff;
    backdrop-filter: blur(10px);
    animation: slideInRight 0.3s ease-out, fadeOut 0.4s ease-in forwards;
    animation-delay: 0s, 3s;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.toast-success {
    background: rgba(34, 197, 94, 0.9);
    border: 1px solid rgba(34, 197, 94, 0.4);
}

.toast-error {
    background: rgba(239, 68, 68, 0.9);
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.toast-info {
    background: rgba(59, 130, 246, 0.9);
    border: 1px solid rgba(59, 130, 246, 0.4);
}

/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.modal-card {
    width: 90%;
    max-width: 500px;
    animation: scaleIn 0.3s ease-out;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    cursor: pointer;
    transition: color var(--transition);
    line-height: 1;
}

.modal-close:hover {
    color: var(--text);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
}

/* ===== Animations ===== */
@keyframes flamePulse {

    0%,
    100% {
        filter: drop-shadow(0 0 8px var(--accent-glow));
    }

    50% {
        filter: drop-shadow(0 0 20px var(--accent-glow)) brightness(1.2);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
        pointer-events: none;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes shakeX {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-8px);
    }

    40% {
        transform: translateX(8px);
    }

    60% {
        transform: translateX(-4px);
    }

    80% {
        transform: translateX(4px);
    }
}

@keyframes glowPulse {

    0%,
    100% {
        box-shadow: 0 0 15px var(--accent-glow);
    }

    50% {
        box-shadow: 0 0 30px var(--accent-glow), 0 0 60px var(--accent-glow);
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .top-nav {
        flex-direction: column;
        gap: 12px;
        padding: 12px 16px;
    }

    .nav-user {
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .glass-card {
        padding: 20px;
    }
}

/* ===== Floating Notepad ===== */
.floating-notepad {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 340px;
    z-index: 500;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.4);
    transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1), box-shadow var(--transition);
    overflow: hidden;
}

.floating-notepad:hover {
    box-shadow: -12px 0 50px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.12);
}

/* ── Collapsed: slim sideways tab ── */
.floating-notepad.collapsed {
    width: 44px;
}

.floating-notepad.collapsed .notepad-header {
    flex-direction: column-reverse;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    padding: 20px 0 18px;
    height: 180px;
    border-bottom: none;
    cursor: pointer;
}

.floating-notepad.collapsed .notepad-title {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    gap: 6px;
    font-size: 0.78rem;
    letter-spacing: 2px;
}

.floating-notepad.collapsed .notepad-title svg {
    display: none;
}

.floating-notepad.collapsed .notepad-toggle svg {
    transform: rotate(-90deg);
}

.notepad-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    cursor: default;
    background: linear-gradient(135deg, var(--accent-soft), transparent);
}

.notepad-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.5px;
}

.notepad-title svg {
    width: 16px;
    height: 16px;
    color: var(--accent);
    flex-shrink: 0;
}

.notepad-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: all var(--transition);
    display: flex;
    align-items: center;
}

.notepad-toggle svg {
    width: 16px;
    height: 16px;
    transition: transform var(--transition);
}

.notepad-toggle:hover {
    color: var(--text);
    background: var(--bg-hover);
}

.notepad-body {
    display: flex;
    flex-direction: column;
}

.notepad-textarea {
    width: 100%;
    min-height: 380px;
    max-height: 60vh;
    padding: 14px 16px;
    background: transparent;
    border: none;
    color: var(--text);
    font-family: inherit;
    font-size: 0.88rem;
    line-height: 1.7;
    resize: vertical;
    outline: none;
    transition: background var(--transition);
}

.notepad-textarea::placeholder {
    color: var(--text-dim);
    font-style: italic;
}

.notepad-textarea:focus {
    background: rgba(255, 255, 255, 0.03);
}

.notepad-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.15);
}

.notepad-clear {
    display: flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    color: var(--text-dim);
    font-family: inherit;
    font-size: 0.75rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: all var(--transition);
}

.notepad-clear svg {
    width: 13px;
    height: 13px;
}

.notepad-clear:hover {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.notepad-chars {
    font-size: 0.7rem;
    color: var(--text-dim);
}

.floating-notepad.collapsed .notepad-header {
    border-bottom: none;
}

@media (max-width: 960px) {
    .floating-notepad {
        width: 300px;
    }

    .floating-notepad.collapsed {
        width: 44px;
    }
}

@media (max-width: 600px) {
    .floating-notepad {
        width: 260px;
        top: auto;
        bottom: 16px;
        transform: none;
    }

    .floating-notepad.collapsed {
        width: 40px;
    }
}

/* ===== Print ===== */
@media print {

    .top-nav,
    .calc-form-section,
    .btn-print,
    .page-header {
        display: none !important;
    }

    body {
        background: #fff;
        color: #000;
    }

    .calc-result-section {
        background: #fff !important;
        border: 1px solid #ccc !important;
        box-shadow: none !important;
    }

    .breakdown-total .bk-value {
        color: #000 !important;
    }
}