:root {
    --primary-color: #1A365D;
    --accent-color: #B87333;
    --text-color: #f9f9f7;
    --bg-darker: #0f2038;
    --panel-bg: rgba(26, 54, 93, 0.7);
    --border-color: rgba(184, 115, 51, 0.3);
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Montserrat', sans-serif;
    --neon-glow: 0 0 10px rgba(184, 115, 51, 0.7), 
                 0 0 20px rgba(184, 115, 51, 0.5), 
                 0 0 30px rgba(184, 115, 51, 0.3);
}

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

body {
    background-color: var(--bg-darker);
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(26, 54, 93, 0.8) 0%, transparent 50%),
        radial-gradient(circle at 90% 80%, rgba(184, 115, 51, 0.1) 0%, transparent 50%);
    background-attachment: fixed;
    color: var(--text-color);
    font-family: var(--font-body);
    min-height: 100vh;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--accent-color);
}

/* --- Header --- */
.app-header {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    height: 100px;
    overflow: hidden;
    width: 100%;
    box-sizing: border-box;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(180deg, var(--primary-color) 0%, transparent 100%);
}

.header-logo {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    max-height: 140px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(249, 249, 247, 0.1));
}

.header-title {
    font-size: 3.5rem;
    text-shadow: var(--neon-glow);
    letter-spacing: 2px;
    margin: 0;
    text-align: center;
}

/* --- Main Container --- */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
}

/* --- Panels (Bespoke Engineering Vibe) --- */
.panel {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.8rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.panel:hover {
    box-shadow: 0 8px 32px rgba(184, 115, 51, 0.15);
}

.panel h2 {
    font-size: 1.6rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.8rem;
    text-shadow: 0 0 5px rgba(184, 115, 51, 0.4);
    letter-spacing: 1px;
}

/* --- Top Section Layout --- */
.top-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
}

/* --- Forms --- */
.form-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.form-group label {
    font-weight: 500;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    color: var(--text-color);
    opacity: 0.9;
}

.form-group input {
    background: rgba(13, 27, 46, 0.8);
    border: 1px solid rgba(249, 249, 247, 0.2);
    border-radius: 8px;
    padding: 0.9rem 1.2rem;
    color: var(--text-color);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.form-group input:hover:not(:focus) {
    border-color: rgba(184, 115, 51, 0.6);
    box-shadow: 0 0 8px rgba(184, 115, 51, 0.2);
    background: rgba(13, 27, 46, 0.85);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: var(--neon-glow);
    background: rgba(13, 27, 46, 0.95);
}

.form-group input::placeholder {
    color: rgba(249, 249, 247, 0.4);
}

/* --- Buttons --- */
.action-panel {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.btn {
    padding: 1.1rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    position: relative;
    overflow: hidden;
}

.btn.primary {
    background: transparent;
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
}

.btn.primary:not(:disabled):hover {
    background: rgba(184, 115, 51, 0.1);
    box-shadow: var(--neon-glow), inset 0 0 15px rgba(184, 115, 51, 0.2);
    text-shadow: 0 0 8px var(--accent-color);
    transform: translateY(-2px);
    border-color: #d18d4f; /* slightly brighter copper */
}

.btn.primary:not(:disabled):active {
    transform: translateY(1px);
    box-shadow: 0 0 5px rgba(184, 115, 51, 0.7);
}

.btn.secondary {
    background: rgba(249, 249, 247, 0.05);
    color: var(--text-color);
    border: 1px solid rgba(249, 249, 247, 0.3);
}

.btn.secondary:hover {
    background: rgba(249, 249, 247, 0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(249, 249, 247, 0.1);
}

.btn:disabled {
    background: rgba(30, 40, 55, 0.6);
    color: rgba(249, 249, 247, 0.3);
    border: 1px solid rgba(249, 249, 247, 0.1);
    cursor: not-allowed;
}

/* --- Metrics Dashboard --- */
.metrics-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.2rem;
    justify-content: space-between;
}

.metric-card {
    flex: 1;
    min-width: 160px;
    background: rgba(13, 27, 46, 0.6);
    border: 1px solid rgba(184, 115, 51, 0.2);
    border-radius: 8px;
    padding: 1.8rem 1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-color);
    box-shadow: 0 8px 20px rgba(184, 115, 51, 0.15);
    background: rgba(13, 27, 46, 0.8);
}

.metric-value {
    font-family: var(--font-heading);
    font-size: 3rem;
    color: var(--accent-color);
    font-weight: 700;
    line-height: 1;
    text-shadow: 0 0 10px rgba(184, 115, 51, 0.3);
}

.metric-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.8;
    font-weight: 500;
}

/* --- Results Table --- */
.table-responsive {
    overflow-x: auto;
    border-radius: 8px;
    background: rgba(13, 27, 46, 0.6);
    border: 1px solid rgba(249, 249, 247, 0.1);
    
    /* Modern Custom Scrollbar */
    --scrollbar-thumb: var(--accent-color);
    --scrollbar-track: rgba(13, 27, 46, 0.6);
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
    scrollbar-width: thin;
}

/* Legacy WebKit fallback for custom scrollbars */
@supports not (scrollbar-color: auto) {
    .table-responsive::-webkit-scrollbar {
        height: 8px;
        width: 8px;
    }
    
    .table-responsive::-webkit-scrollbar-thumb {
        background: var(--scrollbar-thumb);
        border-radius: 4px;
        border: 2px solid var(--scrollbar-track);
    }
    
    .table-responsive::-webkit-scrollbar-track {
        background: var(--scrollbar-track);
        border-radius: 4px;
    }
}

table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

th, td {
    padding: 1.2rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(249, 249, 247, 0.08);
}

th {
    font-family: var(--font-heading);
    color: var(--accent-color);
    font-weight: 600;
    font-size: 1.05rem;
    background: rgba(26, 54, 93, 0.9);
    position: sticky;
    top: 0;
    letter-spacing: 0.5px;
    text-shadow: 0 0 5px rgba(184, 115, 51, 0.2);
}

tbody tr {
    transition: background-color 0.2s ease;
}

tbody tr:hover {
    background-color: rgba(184, 115, 51, 0.08);
}

tbody td {
    font-size: 0.95rem;
}

.lead-website {
    color: #2563eb;
    text-decoration: underline;
}

/* Allow text wrapping for AI columns and Name to prevent excessive width */
tbody td:first-child,
tbody td:last-child, 
tbody td:nth-last-child(2) {
    white-space: normal;
    min-width: 220px;
    line-height: 1.5;
}

/* --- Responsive Adjustments --- */
@media (max-width: 960px) {
    .top-section {
        grid-template-columns: 1fr;
    }
    
    .header-title {
        font-size: 2.2rem;
    }

    .metrics-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 600px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .panel {
        padding: 1.2rem;
    }
}

/* --- Auth Overlay --- */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-darker);
    background-image: 
        radial-gradient(circle at 50% 50%, rgba(26, 54, 93, 0.9) 0%, rgba(15, 32, 56, 1) 100%);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    /* transition for hiding */
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.auth-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.auth-container {
    max-width: 450px;
    width: 90%;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
}

.auth-logo {
    width: 300px;
    height: 300px;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(249, 249, 247, 0.1));
}

.auth-container h2 {
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
    border-bottom: none;
    padding-bottom: 0;
}

.auth-container p {
    color: rgba(249, 249, 247, 0.8);
    font-size: 1.05rem;
    margin-bottom: 1rem;
}

.auth-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.auth-actions .btn {
    width: 100%;
}

.auth-message {
    font-size: 0.9rem !important;
    color: var(--accent-color) !important;
    min-height: 20px;
    margin-bottom: 0 !important;
}

/* --- Error Banner --- */
.error-banner {
    background-color: #ff4d4d;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-top: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 15px rgba(255, 77, 77, 0.3);
    font-weight: 500;
}

.error-banner.hidden {
    display: none;
}

.error-banner-content {
    flex: 1;
    margin-right: 1rem;
}

.error-banner-actions {
    display: flex;
    gap: 0.5rem;
}

.error-banner-actions button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.2s;
}

.error-banner-actions button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* --- Progress Dashboard --- */
.progress-dashboard {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.progress-dashboard h3 {
    margin-bottom: 10px;
    font-size: 1rem;
    color: var(--accent-color);
}
.progress-dashboard p {
    margin-bottom: 5px;
}
.progress-dashboard span {
    font-weight: bold;
    color: var(--text-color);
}
.progress-dashboard p.current-target-label {
    font-size: 0.9rem;
    color: #a0aec0;
    margin-top: 10px;
}
.progress-dashboard p.current-target-label span {
    font-weight: normal;
    color: inherit;
}
.progress-dashboard p.credits-label {
    margin-bottom: 5px;
    margin-top: 10px;
}
#trial-warning {
    font-size: 0.8rem;
    color: #f6c945;
    margin-top: 5px;
    display: none;
}
.metric-card.pain-point {
    border-color: rgba(184, 115, 51, 0.6);
}

.metric-card.sheet-highlight {
    border-color: rgba(184, 115, 51, 0.8);
    background: rgba(184, 115, 51, 0.08);
    box-shadow: 0 0 15px rgba(184, 115, 51, 0.15);
}

.metric-card.sheet-highlight .metric-value {
    text-shadow: 0 0 12px rgba(184, 115, 51, 0.5);
}

.metric-card.sheet-highlight:hover {
    border-color: var(--accent-color);
    box-shadow: 0 8px 20px rgba(184, 115, 51, 0.25);
}
