/* Base Variables */
:root {
    /* Color Palette */
    --bg-color: #0d1117;
    --bg-secondary: #161b22;
    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --accent-purple: #8b5cf6;
    --accent-green: #10b981;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;

    /* Glassmorphism */
    --glass-bg: rgba(22, 27, 34, 0.65);
    --glass-border: rgba(255, 255, 255, 0.08);



    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    --gradient-danger: linear-gradient(135deg, #ef4444, #b91c1c);

    /* Typography */
    --font-main: 'Outfit', sans-serif;

    /* Layout */
    --max-width: 1200px;
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    position: relative;
    -webkit-font-smoothing: antialiased;
}

/* Background Effects */
.background-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.15;
    animation: float 20s infinite ease-in-out alternate;
}

.orb-1 {
    width: 400px;
    height: 400px;
    background: var(--accent-blue);
    top: -100px;
    left: -100px;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: var(--accent-purple);
    bottom: -200px;
    right: -100px;
    animation-delay: -5s;
}

.orb-3 {
    width: 300px;
    height: 300px;
    background: var(--accent-green);
    top: 40%;
    left: 40%;
    animation-delay: -10s;
    opacity: 0.08;
}

@keyframes float {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(50px, 50px) scale(1.1);
    }
}

/* Typography & Utils */
.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 2rem;
}

h1,
h2,
h3,
h4 {
    font-weight: 700;
    line-height: 1.2;
}

h1 {
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    letter-spacing: -0.02em;
}

h2 {
    font-size: clamp(2rem, 3vw, 2.5rem);
    margin-bottom: 1rem;
}

h3 {
    font-size: 1.5rem;
}

.text-warning {
    color: var(--accent-warning);
}

.text-danger {
    color: var(--accent-danger);
}

.text-success {
    color: var(--accent-green);
}

.center {
    text-align: center;
}

.mb-4 {
    margin-bottom: 2rem;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.small-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Components */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
}

.card {
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.icon {
    display: inline-block;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4));
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    padding: 1rem 0;
    border-bottom: 1px solid var(--glass-border);
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.accent-text {
    color: var(--accent-blue);
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
}

.nav-links a:hover {
    color: var(--text-primary);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.8rem 1.8rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 1rem;
    font-family: var(--font-main);
    cursor: pointer;
    text-align: center;
    transition: var(--transition);
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.5);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.full-width {
    width: 100%;
}

/* Hero Section */
.hero {
    min-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 80px;
    text-align: center;
}

.hero-text {
    max-width: 800px;
}

.hero p {
    font-size: clamp(1.1rem, 2vw, 1.25rem);
    color: var(--text-secondary);
    margin: 1.5rem 0 2.5rem;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-blue);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* Sections */
.section {
    padding: 6rem 0;
    margin-bottom: 2rem;
    scroll-margin-top: 80px;
}

.section-header {
    margin-bottom: 3rem;
}

.section-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Calculator Grid */
.calculator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: start;
}

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

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.form-group small {
    display: block;
    color: var(--text-secondary);
    margin-top: 0.4rem;
}

.row-inputs {
    display: flex;
    gap: 1rem;
}

.col {
    flex: 1;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.currency {
    position: absolute;
    left: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    padding: 0.8rem 1rem;
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1rem;
    transition: var(--transition);
}

input[type="number"],
input[type="text"].with-currency {
    padding-left: 2rem;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Results Panel */
.results-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.result-box {
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: var(--radius-md);
    padding: 2.5rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.result-box.glow-effect::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 150px;
    height: 150px;
    background: var(--accent-blue);
    filter: blur(80px);
    opacity: 0.15;
    z-index: 0;
}

.result-box h3,
.result-box .final-bid,
.result-box .stop-warning {
    position: relative;
    z-index: 1;
}

.final-bid {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 1rem 0;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
}

.stop-warning {
    color: var(--accent-danger);
    font-weight: 600;
    background: rgba(239, 68, 68, 0.1);
    display: inline-block;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

.breakdown-box {
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
    padding: 1.5rem 2rem;
}

.breakdown-box h4 {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.breakdown-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.breakdown-list li {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
}

.divider {
    border: none;
    height: 1px;
    background: var(--glass-border);
    margin: 0.5rem 0;
}

.total-row {
    font-weight: 700;
    font-size: 1.1rem !important;
}

.success-row {
    color: var(--accent-green);
    font-weight: 600;
}

/* Tabs */
.tabs {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 3rem;
}

.tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-family: inherit;
    position: relative;
    transition: var(--transition);
}

.tab.active {
    color: var(--text-primary);
}

.tab::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: var(--transition);
}

.tab.active::after {
    width: 100%;
}

.tab-panel {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.tab-panel.active {
    display: block;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.info-card {
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    padding: 2rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.info-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
}

.info-card.warning::before {
    background: var(--accent-warning);
}

.info-card.danger::before {
    background: var(--gradient-danger);
}

.info-card.info::before {
    background: var(--accent-blue);
}

.info-card.success::before {
    background: var(--accent-green);
}

.info-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    background: rgba(255, 255, 255, 0.05);
}

.card-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.info-card h3 {
    margin-bottom: 0.2rem;
}

.info-card .subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-card p {
    font-size: 0.95rem;
    color: #a0aec0;
}

/* Checklist */
.checklist-container {
    max-width: 800px;
    margin: 0 auto;
}

.checklist-group {
    margin-bottom: 2.5rem;
}

.group-title {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.check-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.02);
}

.check-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.check-item.checked {
    opacity: 0.6;
}

.check-item.checked label {
    text-decoration: line-through;
}

.check-item.critical {
    border-left: 3px solid var(--accent-danger);
}

.check-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    border: 2px solid var(--text-secondary);
    border-radius: 6px;
    background: transparent;
    cursor: pointer;
    position: relative;
    transition: var(--transition);
    flex-shrink: 0;
    margin-top: 2px;
}

.check-item input[type="checkbox"]:checked {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

.check-item input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    color: var(--bg-color);
    font-size: 16px;
    font-weight: bold;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.check-item label {
    cursor: pointer;
    line-height: 1.5;
}

.checklist-progress {
    background: rgba(255, 255, 255, 0.05);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2rem;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: var(--gradient-primary);
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

#checklist-text {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* Rules Section */
.rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.rule-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 2rem;
}

.danger-rule {
    border-color: rgba(239, 68, 68, 0.3);
    background: rgba(239, 68, 68, 0.05);
}

.rule-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.danger-rule .rule-title {
    color: var(--accent-danger);
}

/* Footer */
.footer {
    padding: 3rem 0;
    border-top: 1px solid var(--glass-border);
    margin-top: 4rem;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    opacity: 0;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Media Queries */
@media (max-width: 900px) {
    .calculator-grid {
        grid-template-columns: 1fr;
    }

    .hero p br {
        display: none;
    }

    nav .nav-links {
        display: none;
    }
}

@media (max-width: 600px) {
    .card {
        padding: 1.5rem;
    }

    .hero-actions {
        flex-direction: column;
    }

    .row-inputs {
        flex-direction: column;
    }

    .final-bid {
        font-size: 2.5rem;
    }
}

/* Spinner */
.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid rgba(59, 130, 246, 0.2);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* AI Verdict Table Styling */
#verdict-content table {
    width: 100%;
    margin-top: 1.5rem;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.03);
    border-collapse: collapse;
}

#verdict-content th {
    background: rgba(59, 130, 246, 0.1);
    color: var(--accent-blue);
    font-weight: 600;
    padding: 12px;
    text-align: left;
}

#verdict-content td {
    padding: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

#verdict-content tr:last-child td {
    border-bottom: none;
}

#verdict-content a {
    text-decoration: none;
    transition: var(--transition);
}

#verdict-content a:hover {
    text-shadow: 0 0 8px var(--accent-blue);
    text-decoration: underline;
}

/* Upload Area Styles */
.upload-area:hover {
    background: rgba(59, 130, 246, 0.05) !important;
    border-color: rgba(59, 130, 246, 0.5) !important;
}

/* ==================================
   PRINT & EXPORT PDF STYLES
   ================================== */
@media print {

    /* Reset background and text colors for printer ink economy */
    body {
        background: white !important;
        color: black !important;
    }

    /* Hide unnecessary UI elements when printing the report */
    nav,
    .hero,
    .calculator-grid,
    footer,
    .rules,
    .checklist-wrapper,
    #perito-form {
        display: none !important;
    }

    /* Reset the verdict box constraints */
    #verdict-box {
        display: block !important;
        background: white !important;
        border: none !important;
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
        page-break-inside: avoid;
    }

    #verdict-title {
        color: black !important;
        text-align: center;
        border-bottom: 2px solid #ccc;
        padding-bottom: 10px;
    }

    /* Normalize textual elements */
    h2,
    h3,
    h4,
    p,
    span,
    div,
    strong,
    li,
    td,
    th {
        color: black !important;
        background: transparent !important;
    }

    /* Ensure specific borders are visible for structure */
    .print-report-section article,
    .print-report-section section,
    .print-no-break {
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        break-inside: avoid !important;
        page-break-inside: avoid !important;
        background: #fdfdfd !important;
    }

    /* Keep grid structure but change gap/padding for paper */
    .print-report-section {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }

    /* Keep Badges recognizable with physical borders instead of bg colors */
    .badge {
        border: 1px solid #333 !important;
        background: transparent !important;
        color: black !important;
    }

    table,
    th,
    td {
        border: 1px solid #aaa !important;
    }
}

.upload-area.dragover {
    background: rgba(59, 130, 246, 0.1) !important;
    border-color: var(--accent-blue) !important;
    transform: scale(1.02);
}

.upload-text-success {
    color: var(--accent-green) !important;
    font-weight: 600;
}

@keyframes pulse-border {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}

#ai-loading .spinner {
    animation: spin 1s linear infinite, pulse-border 2s infinite;
}