body {
    font-family: "Segoe UI", Roboto, sans-serif;
    margin: 0;
    background-color: #f4f7f6;
}

#header {
    display: flex;
    align-items: center;
    padding: 0.5rem 2rem;
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Logo Styling */
#header .logo {
    height: 30px;
    width: auto;
    margin-right: 1rem;
    border-radius: 5px;
}

/* Title Styling */
#header h1 {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
    letter-spacing: -0.025em;
}

#dashboard {
    width: 100%;
    max-width: 600px;
    padding: 20px;
    margin: auto;
}

.btn-card {
    background: #ffffff;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.error-box {
    background-color: #fff5f5;
    border: 1px solid #feb2b2;
    color: #c53030;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9em;
    animation: slideDown 0.3s ease-out;
}

.small-btn {
    background: #c53030;
    color: white;
    border: none;
    padding: 4px 10px;
    border-radius: 4px;
    margin-left: 10px;
    cursor: pointer;
    font-size: 0.8em;
}

.close-btn {
    background: transparent;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    color: #c53030;
    margin-left: 10px;
}

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

button {
    position: relative; /* For tooltip anchoring */
    padding: 8px 16px;
    border-radius: 5px;
    border: 1px solid grey;
    transition: all 0.2s ease;
    cursor: pointer;
}

.white-btn {
    background-color: #ffffff;
    color: #222;
    box-shadow: 1px 2px 2px #a7adaf61;
}

.blue-btn {
    background-color: #007bff;
    color: white;
    font-weight: 700;
    box-shadow: 1px 2px 2px #a7adaf8c;
}

/* Hover States */
.white-btn:hover:not(:disabled) {
    background-color: #a7adaf61;
}

.blue-btn:hover:not(:disabled) {
    background-color: #0056b3;
}

/* Disabled State */
button:disabled {
    background-color: #cccccc !important;
    color: #666666 !important;
    border: 1px solid #999999;
    cursor: not-allowed;
    opacity: 0.6;
    box-shadow: none;
    transform: none !important;
}

/* Tooltip for Disabled Buttons */
button:disabled:hover::after {
    position: absolute;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 5px 10px;
    font-size: 12px;
    border-radius: 4px;
    white-space: nowrap;
    z-index: 10;
}

/* ==========================================================================
   REPORT COMPONENT STYLES
   ========================================================================== */
#gemini-report {
    display: none;
    background-color: #f5f7fa;
    padding: 2em;
    color: #222;
    line-height: 1.6;
    margin: 20px auto;
}

#gemini-report h1, 
#gemini-report h2, 
#gemini-report h3 {
    color: #113723;
    margin-top: 20px;
    margin-bottom: 0;
}

#gemini-report h1 {
    border-bottom: 3px solid #113723;
    padding-bottom: 0.5em;
    margin-bottom: 1em;
}

#gemini-report h2 {
    color: #19a658;
    margin-top: 1.0em;
    border-bottom: 1px solid #ddd;
    padding-bottom: 0.3em;
}

/* Card & Entry Layouts */
#gemini-report .card, 
#gemini-report .fact-entry {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

#gemini-report .summary, 
#gemini-report .narrative-summary {
    border-left: 4px solid #113723;
}

#gemini-report .fact-entry:nth-of-type(odd) {
    background: #ffffff;
    border-left: 4px solid #333;
}

#gemini-report .fact-entry:nth-of-type(even) {
    background: #f0f2f5;
    border-left: 4px solid #333;
}

/* Tables */
#gemini-report table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 0.95em;
}

#gemini-report th, 
#gemini-report td {
    border: 1px solid #ddd;
    padding: 8px 10px;
    text-align: left;
}

#gemini-report th {
    background-color: #e6e9ed;
    color: #113723;
    font-weight: 600;
}

/* ==========================================================================
    PRINT LOGIC (Optimized)
   ========================================================================== */
@media print {
    /* 1. Hide the UI completely */
    #dashboard, #header, button { 
        display: none !important; 
    }

    /* 2. Reset Body for Print */
    body { 
        background-color: #fff !important; 
        margin: 0; 
        padding: 0;
    }

    /* 3. Ensure the Report takes over the page */
    #gemini-report {
        background-color: #fff !important;
        visibility: visible !important;
        display: block !important;
        position: static !important; /* Changed from absolute to prevent clipping */
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        /* Critical for borders/backgrounds */
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .h3 {
        margin-top: 20px;
    }
    
    /* 4. Fix the Borders */
    .card, .summary, .fact-entry, .narrative-summary {
        /* Force borders to show */
        border-left: 4px solid #113723 !important; 
        background-color: #ffffff !important;
        display: block !important;
        page-break-inside: avoid;
        margin-bottom: 20px !important;
        /* Remove shadows as they look muddy on paper */
        box-shadow: none !important;
        border-top: 1px solid #eee;
        border-right: 1px solid #eee;
        border-bottom: 1px solid #eee;
    }
    
    /* Distinct border color for fact entries */
    .fact-entry {
        border-left: 4px solid #333 !important;
    }

    /* 5. Ensure tables don't vanish */
    table, th, td {
        border: 1px solid #ddd !important;
        visibility: visible !important;
    }
}