/* 
   FinTools Next-Gen Theme - God Mode
   Focus: Futuristic, Deep Glass, Motion, Holographic Interactions
*/

:root {
    /* --- 1. Neon-Infused Palette --- */
    --c-primary: #6366f1;
    /* Indigo 500 - Brighter */
    --c-primary-hover: #4f46e5;
    /* Indigo 600 */
    --c-primary-glow: rgba(99, 102, 241, 0.5);

    --c-accent: #a855f7;
    /* Purple 500 */
    --c-accent-glow: rgba(168, 85, 247, 0.5);

    --c-bg-page: #0f172a;
    /* Slate 900 (Dark Mode Base) */
    --c-bg-mesh-1: #4f46e5;
    --c-bg-mesh-2: #ec4899;
    /* Pink 500 */
    --c-bg-mesh-3: #06b6d4;
    /* Cyan 500 */

    --c-surface: rgba(255, 255, 255, 0.85);
    /* Light mode card defaulting for now, but Next Gen usually dark? */
    /* Let's stay Light Mode "Next Gen" (Clean Tech) to keep consistency with previous steps, but add vibrant mesh */
    --c-surface-glass: rgba(255, 255, 255, 0.65);

    --c-text-main: #0f172a;
    --c-text-sec: #475569;
    --c-text-light: #94a3b8;

    --c-border: rgba(255, 255, 255, 0.6);
    --c-border-highlight: rgba(255, 255, 255, 0.9);

    /* --- 2. Advanced Typography --- */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* --- 3. Spacing & Radius --- */
    --radius-xl: 1.5rem;
    --radius-2xl: 2rem;

    /* --- 4. Shadows & Glows --- */
    --shadow-glass:
        0 4px 30px rgba(0, 0, 0, 0.1),
        inset 0 0 20px rgba(255, 255, 255, 0.5);

    --glow-primary: 0 0 20px var(--c-primary-glow);

    /* --- 5. Animation Curves --- */
    --ease-elastic: cubic-bezier(0.68, -0.6, 0.32, 1.6);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    color: var(--c-text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    /* Aurora Background */
    background-color: #f0f4f8;
    background-image:
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 0%, rgba(236, 72, 153, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(6, 182, 212, 0.15) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(168, 85, 247, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
    animation: auroraFlow 20s ease-in-out infinite alternate;
}

@keyframes auroraFlow {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* --- Components: Holographic Glass Cards --- */
.glass-panel,
.tool-card {
    background: var(--c-surface-glass);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-top: 1px solid rgba(255, 255, 255, 0.8);
    border-left: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow-glass);
    border-radius: var(--radius-xl);
    transition: all 0.4s var(--ease-smooth);
    position: relative;
    overflow: hidden;
}

/* Shine Hover Effect */
.glass-panel::after,
.tool-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -150%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transform: skewX(-20deg);
    transition: 0.5s;
    pointer-events: none;
}

.tool-card:hover::after {
    left: 150%;
    transition: 0.7s ease-in-out;
}

.tool-card:hover {
    transform: translateY(-8px) scale(1.01);
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.1),
        0 0 20px rgba(99, 102, 241, 0.2);
    border-color: white;
    z-index: 10;
}

/* Tool Card Layout Fix */
.tool-card {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-6);
    text-decoration: none;
}

/* --- Typography Upgrade --- */
h1,
h2,
h3 {
    font-family: var(--font-heading);
    letter-spacing: -0.03em;
}

h1 {
    font-size: 3.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #1e293b 0%, #4f46e5 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 10px rgba(79, 70, 229, 0.1);
}

.text-gradient {
    background: linear-gradient(to right, #6366f1, #ec4899);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
}

/* --- Forms: Cyber-Glass (Next Gen v5 - Structured) --- */
.control-panel {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(24px);
    border-radius: var(--radius-2xl);
    padding: 2.5rem;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.05),
        inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    /* Consistent gap */
    margin-bottom: 1.5rem;
    width: 100%;
}

.form-label {
    display: block;
    /* Ensures full width block behavior */
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 0.08em;
    /* Gradient Text */
    /* Gradient Text Removed for better readability on Glass */
    /* background: linear-gradient(135deg, var(--c-primary) 0%, var(--c-accent) 100%); */
    color: var(--c-text-sec);
    /* background-clip: text; */
    /* -webkit-background-clip: text; */
    /* -webkit-text-fill-color: transparent; */
    /* Reset padding/margin for strict alignment */
    margin: 0;
    padding: 0;
    line-height: 1;
}

/* --- USER REQUEST: INCREASE INPUT SIZE --- */
.form-input {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(12px);
    border: none;
    border-bottom: 2px solid rgba(99, 102, 241, 0.3);
    border-radius: 6px 6px 0 0;

    /* ENLARGED SIZE as requested */
    padding: 1.25rem 1.75rem;
    /* Increased padding */
    font-size: 1.25rem;
    /* Larger Font */

    font-weight: 600;
    color: var(--c-text-main);
    width: 100%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 -1px 0 0 rgba(255, 255, 255, 0.5);
}

.form-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.95);
    border-bottom-color: var(--c-primary);
    box-shadow:
        0 10px 20px -10px rgba(99, 102, 241, 0.3),
        inset 0 -2px 0 0 var(--c-primary);
    /* No movement on focus to maintain structure */
    transform: none;
}

/* --- Buttons: Liquid Gradient --- */
.btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
    background-size: 200% 200%;
    color: white;
    padding: 1rem 2rem;
    border-radius: 16px;
    font-weight: 700;
    font-size: 1.1rem;
    border: none;
    cursor: pointer;
    box-shadow:
        0 10px 20px rgba(99, 102, 241, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transition: all 0.3s var(--ease-elastic);
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow:
        0 15px 30px rgba(99, 102, 241, 0.4),
        0 0 30px rgba(236, 72, 153, 0.3);
}

/* --- Drag & Drop: Pulse --- */
.drop-zone {
    border: 2px dashed rgba(99, 102, 241, 0.4);
    background: radial-gradient(circle at center, rgba(99, 102, 241, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
    border-radius: var(--radius-xl);
    padding: 3rem 2rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;

    /* Flex Centering */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: var(--c-primary);
    background: rgba(99, 102, 241, 0.1);
    transform: scale(1.005);
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.15);
}

.drop-zone.drag-over::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(99, 102, 241, 0.1);
    animation: pulseBg 1.5s infinite;
}

@keyframes pulseBg {
    0% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.5;
    }
}

/* --- Layout Utils: Fitted Objects (Rev 2) --- */
.app-container {
    width: 95%;
    /* Responsive width */
    max-width: 1400px;
    /* Enhanced for wide screens */
    margin: 0 auto;
    padding: 3rem 2rem;
}

.tools-grid {
    display: grid;
    /* Reduced min-width from 300px to 260px for better fit */
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 2rem;
    /* Reduced gap from 3rem */
}

.tool-icon {
    font-size: 2.2rem;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

/* Better Contrast for Tool Cards */
.tool-info h3 {
    color: var(--c-text-main);
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
}

.tool-info p {
    color: var(--c-text-sec);
    font-size: 0.85rem;
}

.calculator-layout {
    display: grid;
    gap: 3rem;
    width: 100%;
}

@media(min-width: 1024px) {

    /* Desktop Optimization */
    .calculator-layout {
        grid-template-columns: 450px 1fr;
        /* Fixed Sidebar + Fluid Main */
        align-items: stretch;
        /* Vertical Sync */
    }
}

.result-panel {
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 500px;
    /* Ensure panel itself is substantial */
}

.chart-container {
    margin-top: 1rem;
    width: 100%;
    height: 500px;
    /* Fixed Height for Google Charts */
    min-height: 500px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Footer */
.simple-footer {
    padding: 6rem 0 4rem;
    text-align: center;
    color: var(--c-text-light);
    font-weight: 500;
    opacity: 0.8;
}

/* --- Ad Containers (CLS Prevention & Safety) --- */
.ad-container {
    display: block;
    margin: 3.5rem auto;
    /* Ensures 50px+ vertical spacing (50px ~ 3.125rem) */
    text-align: center;
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    /* Placeholder faint bg */
    border-radius: 8px;
    overflow: hidden;
}

/* Ad Labeling */
.ad-container::before {
    content: 'Advertisement';
    display: block;
    font-size: 0.65rem;
    color: var(--c-text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
    opacity: 0.6;
}

/* Fixed Sizes to Prevent Layout Shifts (CLS) */
.ad-leaderboard {
    min-height: 90px;
    min-width: 728px;
}

.ad-rectangle {
    min-height: 250px;
    min-width: 300px;
}

.ad-sidebar {
    position: sticky;
    /* Phase 3 Prep */
    top: 5rem;
    min-height: 600px;
    min-width: 300px;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
    .app-container {
        padding: 1rem 0.5rem;
        width: 100%;
    }

    .mega-group {
        padding: 1.25rem;
        /* Reduce padding from 2.5rem */
    }

    .tools-grid {
        grid-template-columns: 1fr;
        /* Force single column */
        gap: 1.5rem;
    }

    .tool-card {
        padding: 1rem;
        /* Reduce card padding */
    }

    h1 {
        font-size: 2rem;
    }

    .ad-leaderboard {
        min-height: 50px;
        min-width: 300px;
        /* Allow smaller fit */
    }

    .ad-sidebar {
        position: static;
        min-height: 250px;
    }
}

/* --- Dark Mode Support --- */
@media (prefers-color-scheme: dark) {
    :root {
        --c-bg-page: #020617;
        /* Slate 950 */
        --c-surface: rgba(15, 23, 42, 0.85);
        /* Slate 900 */
        --c-surface-glass: rgba(15, 23, 42, 0.65);
        --c-text-main: #f8fafc;
        /* Slate 50 */
        --c-text-sec: #cbd5e1;
        /* Slate 300 */
        --c-border: rgba(255, 255, 255, 0.1);
    }

    .ad-container {
        background: rgba(0, 0, 0, 0.3);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .ad-container::before {
        color: rgba(255, 255, 255, 0.4);
    }

    /* Dark Mode Inputs */
    .form-input {
        background: rgba(15, 23, 42, 0.6);
        color: var(--c-text-main);
        border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    }

    .form-input:focus {
        background: rgba(15, 23, 42, 0.95);
    }
}

/* Mobile responsive adjustments existing block extension */
@media (max-width: 768px) {
    .control-panel {
        padding: 1.5rem;
        /* Reduced from 2.5rem */
    }
}

/* --- Navigation Tabs (Migrated from Index) --- */
.tabs-container {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding: 0.75rem 1rem;
    background: var(--c-surface-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--c-border);
    position: sticky;
    top: 0;
    z-index: 40;
    scrollbar-width: none;
    margin-bottom: 2rem;
    white-space: nowrap;
    align-items: center;
}

.tabs-container::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    display: inline-block;
    text-decoration: none;
    white-space: nowrap;
    padding: 0.4rem 1rem;
    border: none;
    background: transparent;
    color: var(--c-text-sec);
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 9999px;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--c-primary);
}

.tab-btn.active {
    background: var(--c-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.category-title {
    font-size: 1.5rem;
    color: var(--c-text-main);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    font-family: var(--font-heading);
    font-weight: 700;
}

.icon-circle {
    display: inline-flex;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 50%;
    font-size: 1.25rem;
}


/* --- PDF File List Styling --- */
.file-row {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.4);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.5);
    margin-bottom: 0.5rem;
    animation: fadeIn 0.3s ease-out;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    overflow: hidden;
}

.file-icon {
    color: var(--c-primary);
    flex-shrink: 0;
}

.file-name {
    font-weight: 500;
    color: var(--c-text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.9rem;
}

.file-size {
    font-size: 0.8rem;
    color: var(--c-text-sec);
    margin-left: auto;
    white-space: nowrap;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Sortable List Styling --- */
.sortable-ghost {
    opacity: 0.4;
    background: var(--c-bg-mesh-1);
}

.sortable-drag {
    cursor: grabbing;
}

.file-row {
    background: rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(4px);
    transition: transform 0.2s, box-shadow 0.2s;
}

.file-row:hover {
    transform: translateX(4px);
    background: rgba(255, 255, 255, 0.6);
    border-color: var(--c-primary);
}

.drag-handle {
    cursor: grab;
    color: var(--c-text-light);
    margin-right: 0.75rem;
    font-size: 1.25rem;
    transition: color 0.2s;
}

.file-row:hover .drag-handle {
    color: var(--c-primary);
}

/* --- Mega Group Layout (Redesign) --- */
.mega-group {
    background: var(--c-surface-glass);
    backdrop-filter: blur(20px);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-2xl);
    padding: 2.5rem;
    margin-bottom: 3rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: var(--shadow-glass);
}

.mega-group:hover {
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
}

/* Mega Group Accents */
.mega-group.accent-indigo {
    border-left: 5px solid #6366f1;
}

.mega-group.accent-rose {
    border-left: 5px solid #f43f5e;
}

.mega-group.accent-emerald {
    border-left: 5px solid #10b981;
}

.mega-group.accent-slate {
    border-left: 5px solid #64748b;
}

/* Hide tools when filtering */
.hidden-tool {
    display: none !important;
}

/* Search Bar Styling */
.search-container {
    max-width: 600px;
    margin: 0 auto 3rem;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 1.25rem 3rem 1.25rem 1.5rem;
    font-size: 1.1rem;
    border: 2px solid var(--c-border);
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    transition: all 0.3s;
    outline: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}

.search-input:focus {
    border-color: var(--c-primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
    background: white;
}

.search-icon {
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.25rem;
    color: var(--c-text-sec);
    pointer-events: none;
}