/* ==========================================================================
   TNAADO Tools - Financial Calculator Platform Styles
   Self-contained styles - NO dependencies on main.css
   ========================================================================== */

/* ==================== CSS Reset & Base Styles ==================== */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #ffffff;
    color: #1e293b;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Padding is now handled dynamically by tools-nav.js via has-tools-nav class */
    /* Default: no padding (handled by JS), fallback for pages without tools nav */
    scroll-padding-top: 130px; /* Add scroll padding for anchor navigation */
}

/* Fallback for tools pages without JS loading the nav */
body:not(.has-tools-nav) {
    padding-top: 90px;
}

/* Mobile: Only main header (70px) */
@media (max-width: 768px) {
    body:not(.has-tools-nav) {
        padding-top: 70px;
    }
    body {
        scroll-padding-top: 80px;
    }
}

/* ==================== Tools Hero Section ==================== */
.tools-hero {
    background: linear-gradient(135deg, #A81327 0%, #8B0E1F 50%, #121212 100%);
    padding: 80px 20px 60px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.tools-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

.tools-hero-content {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.tools-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

.tools-hero-badge i {
    font-size: 16px;
}

.tools-hero-title {
    font-size: 48px;
    font-weight: 800;
    color: white;
    margin: 0 0 16px;
    letter-spacing: -1px;
}

.tools-hero-subtitle {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.85);
    margin: 0 0 32px;
    line-height: 1.6;
}

/* ==================== Search Bar ==================== */
.tools-search-container {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

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

.tools-search-icon {
    position: absolute;
    left: 20px;
    color: #64748b;
    font-size: 18px;
    pointer-events: none;
}

.tools-search-input {
    width: 100%;
    padding: 18px 50px 18px 50px;
    font-size: 16px;
    border: none;
    border-radius: 12px;
    background: white;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    outline: none;
    transition: all 0.3s ease;
}

.tools-search-input:focus {
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3), 0 0 0 3px rgba(168, 19, 39, 0.3);
}

.tools-search-input::placeholder {
    color: #94a3b8;
}

.tools-search-clear {
    position: absolute;
    right: 16px;
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.tools-search-clear:hover {
    background: #f1f5f9;
    color: #334155;
}

.tools-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-height: 400px;
    overflow-y: auto;
    z-index: 100;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    text-decoration: none;
    color: #334155;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f1f5f9;
}

.search-result-item:hover {
    background: #f8fafc;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(168, 19, 39, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #A81327;
}

.search-result-content h4 {
    margin: 0 0 4px;
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
}

.search-result-content p {
    margin: 0;
    font-size: 13px;
    color: #64748b;
}

.search-no-results {
    padding: 30px 20px;
    text-align: center;
    color: #64748b;
}

/* ==================== Ad Placements ==================== */
.ad-container {
    display: flex;
    justify-content: center;
    padding: 20px;
    background: #f8fafc;
}

.ad-placeholder {
    background: #e2e8f0;
    border: 2px dashed #cbd5e1;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.ad-header .ad-placeholder,
.ad-footer .ad-placeholder {
    width: 728px;
    height: 90px;
    max-width: 100%;
}

.ad-mid-content .ad-placeholder {
    width: 300px;
    height: 250px;
}

.ad-sidebar .ad-placeholder {
    width: 160px;
    height: 600px;
}

/* ==================== Page Layout with Ad Sidebars ==================== */
.tools-page-layout {
    display: flex;
    max-width: 1720px;
    margin: 0 auto;
    padding: 0;
    gap: 0;
    justify-content: center;
}

.ad-sidebar-column {
    width: 160px;
    flex-shrink: 0;
    padding: 30px 20px;
    position: sticky;
    top: 100px;
    height: fit-content;
    max-height: calc(100vh - 120px);
}

.ad-sidebar-column .ad-container {
    padding: 0;
    background: transparent;
}

/* Hide side ads on smaller screens */
@media (max-width: 1399px) {
    .ad-sidebar-column {
        display: none;
    }
}

/* ==================== MOBILE RESPONSIVE FIXES ==================== */
/* Mobile: 480px breakpoint */
@media (max-width: 480px) {
    body {
        padding-top: 90px;
    }

    /* Hide quick nav on mobile */
    .calculator-quick-nav {
        display: none;
    }

    /* Adjust hero section */
    .tools-hero {
        padding: 40px 16px 30px;
    }

    .tools-hero-title {
        font-size: 28px;
        margin-bottom: 12px;
    }

    .tools-hero-subtitle {
        font-size: 14px;
        margin-bottom: 20px;
    }

    .breadcrumb {
        font-size: 12px !important;
        flex-wrap: wrap;
    }

    .breadcrumb a {
        font-size: 12px !important;
    }

    /* Main layout adjustments */
    .tools-page-layout {
        padding: 0 !important;
    }

    .tools-main-wrapper {
        padding: 16px !important;
        gap: 16px;
    }

    /* Hide sidebars completely */
    .ad-sidebar-column {
        display: none !important;
    }

    /* Form layouts */
    .tool-interface {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
        margin: 0 !important;
    }

    .input-section,
    .output-section {
        gap: 0.75rem !important;
    }

    /* Buttons full width on mobile */
    .button-group {
        flex-direction: column !important;
        gap: 8px !important;
    }

    .btn {
        width: 100% !important;
        padding: 12px 16px !important;
        font-size: 14px !important;
        justify-content: center !important;
    }

    .btn-primary,
    .btn-secondary,
    .btn-copy {
        width: 100% !important;
    }

    /* Form inputs */
    textarea {
        min-height: 150px !important;
        font-size: 16px !important;
        padding: 12px !important;
    }

    .control-group {
        margin-bottom: 12px;
    }

    .control-group label {
        font-size: 13px !important;
    }

    .control-group input,
    .control-group select {
        padding: 12px !important;
        font-size: 16px !important;
        height: 44px !important;
    }

    /* Color pickers */
    .color-input-wrapper {
        flex-direction: column !important;
        padding: 16px !important;
    }

    .color-input-wrapper input[type="color"] {
        width: 100% !important;
        height: 100px !important;
    }

    .color-input-info h3 {
        font-size: 18px !important;
    }

    /* Statistics grid */
    .stats-container {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .stat-card {
        padding: 16px !important;
    }

    .stat-value {
        font-size: 2rem !important;
    }

    /* Dice visual */
    .dice-visual {
        gap: 8px !important;
        flex-wrap: wrap !important;
    }

    .die {
        width: 60px !important;
        height: 60px !important;
        font-size: 1.5rem !important;
    }

    /* Dice controls */
    .dice-controls {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
        margin-bottom: 16px !important;
    }

    .dice-types {
        gap: 6px !important;
        flex-wrap: wrap !important;
    }

    .dice-btn {
        padding: 10px 12px !important;
        font-size: 13px !important;
        flex: 1 1 calc(33.333% - 4px) !important;
        min-width: 50px !important;
    }

    /* Presets */
    .presets {
        gap: 6px !important;
    }

    .preset-btn {
        padding: 8px 12px !important;
        font-size: 12px !important;
        flex: 1 1 calc(50% - 3px) !important;
    }

    /* Coin container */
    .coin-container {
        padding: 20px 16px !important;
    }

    .coin {
        width: 150px !important;
        height: 150px !important;
    }

    .coin-face {
        font-size: 2.5rem !important;
    }

    .coin-result {
        font-size: 1.5rem !important;
    }

    /* Multiple flips */
    .multiple-flips {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 12px !important;
    }

    .multiple-flips input {
        width: 100% !important;
        padding: 12px !important;
    }

    /* Harmony selector */
    .harmony-selector {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    .harmony-option {
        padding: 12px !important;
    }

    .harmony-option h4 {
        font-size: 13px !important;
    }

    .harmony-option p {
        font-size: 11px !important;
    }

    /* Palette display */
    .palette-display {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0 !important;
        margin-bottom: 16px !important;
    }

    .palette-color {
        padding: 12px !important;
    }

    .palette-color-hex {
        font-size: 11px !important;
        padding: 6px 8px !important;
        word-break: break-word !important;
    }

    .palette-color-btn {
        width: 28px !important;
        height: 28px !important;
        font-size: 12px !important;
    }

    /* Gradient preview */
    .gradient-preview {
        height: 200px !important;
        margin-bottom: 16px !important;
    }

    .gradient-type-selector {
        gap: 8px !important;
        margin-bottom: 16px !important;
    }

    .gradient-type-btn {
        padding: 12px !important;
        font-size: 13px !important;
        gap: 6px !important;
    }

    /* Color stops */
    .color-stop {
        gap: 8px !important;
        padding: 10px !important;
        flex-wrap: wrap !important;
    }

    .color-stop input[type="color"] {
        width: 40px !important;
        height: 35px !important;
    }

    .color-stop-position {
        min-width: 40px !important;
        font-size: 12px !important;
    }

    /* Angle control */
    .angle-control {
        flex-direction: column !important;
        padding: 16px !important;
    }

    .angle-display {
        width: 70px !important;
        height: 70px !important;
        font-size: 16px !important;
    }

    /* Radio groups */
    .radio-group {
        flex-direction: column !important;
        gap: 10px !important;
    }

    .radio-option {
        padding: 10px !important;
    }

    /* Character count */
    .char-count {
        font-size: 12px !important;
    }

    /* Tool container */
    .tool-container {
        padding: 0 !important;
    }

    /* Ad spaces */
    .ad-container {
        padding: 12px !important;
    }

    .ad-placeholder {
        font-size: 10px !important;
    }
}

/* Tablet: 768px breakpoint */
@media (max-width: 768px) {
    body {
        padding-top: 90px;
    }

    /* Hide quick nav on tablet */
    .calculator-quick-nav {
        display: none;
    }

    .tools-hero {
        padding: 50px 20px 40px;
    }

    .tools-hero-title {
        font-size: 32px;
    }

    .tools-hero-subtitle {
        font-size: 16px;
    }

    .tools-main-wrapper {
        padding: 20px !important;
        gap: 20px;
    }

    .tool-interface {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
    }

    .button-group {
        flex-direction: column !important;
        gap: 10px !important;
    }

    .btn {
        width: 100% !important;
        padding: 12px 20px !important;
    }

    .control-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }

    .color-input-wrapper {
        flex-direction: column !important;
    }

    .color-input-wrapper input[type="color"] {
        width: 100% !important;
        height: 80px !important;
    }

    .stats-container {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
    }

    .dice-controls {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px !important;
    }

    .dice-types {
        gap: 8px !important;
        flex-wrap: wrap !important;
    }

    .dice-btn {
        flex: 1 1 calc(50% - 4px) !important;
        padding: 12px !important;
    }

    .presets {
        gap: 8px !important;
        flex-wrap: wrap !important;
    }

    .preset-btn {
        flex: 1 1 calc(50% - 4px) !important;
        min-width: 80px !important;
    }

    .palette-display {
        grid-template-columns: repeat(4, 1fr) !important;
    }

    .gradient-type-selector {
        gap: 10px !important;
    }

    .gradient-type-btn {
        padding: 14px !important;
        font-size: 14px !important;
    }

    .angle-control {
        gap: 20px !important;
    }

    .radio-group {
        flex-direction: row !important;
        gap: 20px !important;
    }

    .harmony-selector {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    .history-item {
        flex-direction: column !important;
        align-items: flex-start !important;
    }

    .history-roll {
        width: 100% !important;
        word-break: break-word !important;
    }
}

/* ==================== Main Layout ==================== */
.tools-main-wrapper {
    display: flex;
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px 20px;
    gap: 30px;
    flex: 1;
}

/* ==================== Sidebar ==================== */
.tools-sidebar {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 100px;
    height: fit-content;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.tools-sidebar-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #A81327, #8B0E1F);
    border-radius: 12px 12px 0 0;
}

.tools-sidebar-header h3 {
    margin: 0;
    color: white;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.tools-sidebar-nav {
    background: white;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.sidebar-category {
    border-bottom: 1px solid #f1f5f9;
}

.sidebar-category:last-child {
    border-bottom: none;
}

.sidebar-category-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #334155;
    transition: all 0.2s ease;
    text-align: left;
}

.sidebar-category-toggle:hover {
    background: #f8fafc;
    color: #A81327;
}

.sidebar-category-toggle i:first-child {
    width: 20px;
    text-align: center;
    color: #A81327;
}

.sidebar-category-toggle span {
    flex: 1;
}

.sidebar-category-toggle .toggle-icon {
    font-size: 12px;
    color: #94a3b8;
    transition: transform 0.3s ease;
}

.sidebar-category.active .toggle-icon {
    transform: rotate(180deg);
}

.sidebar-category-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: #f8fafc;
}

.sidebar-category.active .sidebar-category-list {
    max-height: 500px;
}

.sidebar-category-list li a {
    display: block;
    padding: 10px 16px 10px 48px;
    font-size: 13px;
    color: #64748b;
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-category-list li a:hover {
    color: #A81327;
    background: white;
    border-left-color: #A81327;
}

.sidebar-category-list li a.active {
    color: #A81327;
    font-weight: 600;
    background: white;
    border-left-color: #A81327;
}

/* ==================== Main Content ==================== */
.tools-content {
    flex: 1;
    min-width: 0;
}

.tools-section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f1f5f9;
}

.tools-section-title i {
    color: #A81327;
}

/* ==================== Tool Cards ==================== */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.featured-grid {
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

.tool-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
    border: 1px solid #f1f5f9;
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(168, 19, 39, 0.12);
    border-color: rgba(168, 19, 39, 0.2);
}

.tool-card.featured {
    padding: 24px;
}

.tool-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(168, 19, 39, 0.1), rgba(168, 19, 39, 0.05));
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tool-card-icon i {
    font-size: 24px;
    color: #A81327;
}

.tool-card-icon.small {
    width: 44px;
    height: 44px;
}

.tool-card-icon.small i {
    font-size: 18px;
}

.tool-card-content {
    flex: 1;
    min-width: 0;
}

.tool-card-content h3,
.tool-card-content h4 {
    margin: 0 0 6px;
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
}

.tool-card-content p {
    margin: 0;
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
}

.tool-card-arrow {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.tool-card-arrow i {
    font-size: 12px;
    color: #64748b;
    transition: all 0.3s ease;
}

.tool-card:hover .tool-card-arrow {
    background: #A81327;
}

.tool-card:hover .tool-card-arrow i {
    color: white;
    transform: translateX(2px);
}

/* ==================== Category Sections ==================== */
.category-section {
    margin-bottom: 48px;
}

.category-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    color: #334155;
    margin: 0 0 16px;
}

.category-title i {
    color: #A81327;
    font-size: 16px;
}

/* ==================== Calculator Page Styles ==================== */
.calculator-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px 30px 20px; /* Increased top padding to prevent header overlap */
}

.calculator-header {
    margin-bottom: 30px;
}

/* ==================== Calculator Quick Navigation ==================== */
.calculator-quick-nav {
    background: linear-gradient(135deg, #A81327, #8B0E1F);
    padding: 12px 20px;
    margin-bottom: 0;
}

.calculator-quick-nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.calculator-quick-nav-back {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.calculator-quick-nav-back:hover {
    background: rgba(255, 255, 255, 0.25);
}

.calculator-quick-nav-back i {
    font-size: 12px;
}

.calculator-quick-nav-categories {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.calculator-quick-nav-categories a {
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.calculator-quick-nav-categories a:hover {
    color: white;
    background: rgba(255, 255, 255, 0.15);
}

.calculator-quick-nav-categories a.active {
    color: white;
    background: rgba(255, 255, 255, 0.2);
    font-weight: 500;
}

@media (max-width: 768px) {
    .calculator-quick-nav-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .calculator-quick-nav-categories {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 4px;
        flex-wrap: nowrap;
    }

    .calculator-quick-nav-categories a {
        white-space: nowrap;
    }
}

.calculator-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #475569;
    margin-bottom: 16px;
}

.calculator-breadcrumb a {
    color: #A81327;
    text-decoration: none;
    font-weight: 500;
}

.calculator-breadcrumb a:hover {
    text-decoration: underline;
}

.calculator-breadcrumb span {
    color: #64748b;
}

.calculator-title {
    font-size: 32px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 12px;
}

.calculator-description {
    font-size: 16px;
    color: #475569;
    margin: 0;
    line-height: 1.6;
}

/* Calculator Form */
.calculator-wrapper {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 30px;
}

.calculator-form {
    background: white;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    color: #1e293b; /* Ensure dark text on white background */
}

.calculator-form * {
    color: #1e293b; /* Force all child elements to have dark text */
}

.calculator-form label {
    color: #1e293b !important; /* Override any inherited styles */
}

.calculator-results {
    background: linear-gradient(135deg, #A81327, #8B0E1F);
    border-radius: 16px;
    padding: 30px;
    color: #ffffff !important;
    position: sticky;
    top: 100px;
    height: fit-content;
}

.calculator-results * {
    color: #ffffff !important;
}

.calculator-results a {
    color: #ffffff !important;
    text-decoration: underline;
}

.form-section {
    margin-bottom: 24px;
}

.form-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-section-title i {
    color: #A81327;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 8px;
}

.form-group .input-wrapper {
    position: relative;
}

.form-group .input-prefix,
.form-group .input-suffix {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #475569;
    font-size: 14px;
    font-weight: 500;
    pointer-events: none;
}

.form-group .input-prefix {
    left: 14px;
}

.form-group .input-suffix {
    right: 14px;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    outline: none;
    transition: all 0.2s ease;
    background: white;
    color: #1e293b !important; /* Force dark text in inputs */
}

.form-group input.has-prefix {
    padding-left: 32px;
}

.form-group input.has-suffix {
    padding-right: 40px;
}

.form-group input:focus,
.form-group select:focus {
    border-color: #A81327;
    box-shadow: 0 0 0 4px rgba(168, 19, 39, 0.1);
}

.form-group input::placeholder {
    color: #94a3b8;
}

.form-help {
    font-size: 12px;
    color: #64748b;
    margin-top: 6px;
}

/* Calculate Button */
.calculate-btn {
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #A81327, #8B0E1F);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.calculate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(168, 19, 39, 0.3);
}

.calculate-btn:active {
    transform: translateY(0);
}

/* Results Panel */
.results-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.results-header h3 {
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 8px;
    color: #ffffff !important;
}

.results-main-value {
    font-size: 48px;
    font-weight: 800;
    margin: 0;
    letter-spacing: -1px;
    color: #ffffff !important;
}

.results-frequency {
    font-size: 14px;
    color: #ffffff !important;
}

.results-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.result-item:last-child {
    border-bottom: none;
}

.result-label {
    font-size: 14px;
    color: #ffffff !important;
}

.result-value {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff !important;
}

/* Amortization Table */
.amortization-section {
    margin-top: 40px;
}

.amortization-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    transition: all 0.2s ease;
}

.amortization-toggle:hover {
    background: #f8fafc;
}

.amortization-toggle h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 10px;
}

.amortization-toggle h4 i {
    color: #A81327;
}

.amortization-toggle .toggle-icon {
    color: #64748b;
    transition: transform 0.3s ease;
}

.amortization-toggle.active .toggle-icon {
    transform: rotate(180deg);
}

.amortization-table-container {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    margin-top: 16px;
}

.amortization-table-container.active {
    max-height: 600px;
    overflow-y: auto;
}

.amortization-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.amortization-table th,
.amortization-table td {
    padding: 12px 16px;
    text-align: right;
    font-size: 13px;
}

.amortization-table th:first-child,
.amortization-table td:first-child {
    text-align: left;
}

.amortization-table thead {
    background: #f8fafc;
}

.amortization-table th {
    font-weight: 600;
    color: #334155;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 11px;
}

.amortization-table tbody tr {
    border-bottom: 1px solid #f1f5f9;
}

.amortization-table tbody tr:hover {
    background: #f8fafc;
}

.amortization-table td {
    color: #64748b;
}

/* Related Calculators */
.related-calculators {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 2px solid #f1f5f9;
}

.related-calculators h3 {
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.related-calculators h3 i {
    color: #A81327;
}

/* SEO Content Section */
.calculator-info {
    margin-top: 48px;
    padding: 32px;
    background: #f8fafc;
    border-radius: 16px;
}

.calculator-info h3 {
    font-size: 20px;
    font-weight: 600;
    color: #1e293b;
    margin: 0 0 16px;
}

.calculator-info p {
    font-size: 15px;
    color: #64748b;
    line-height: 1.7;
    margin: 0 0 16px;
}

.calculator-info p:last-child {
    margin-bottom: 0;
}

.calculator-info ul {
    margin: 16px 0;
    padding-left: 24px;
}

.calculator-info li {
    font-size: 15px;
    color: #64748b;
    line-height: 1.7;
    margin-bottom: 8px;
}

/* ==================== Calculator Disclaimer ==================== */
.calculator-disclaimer {
    margin-top: 32px;
    padding: 24px;
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: 12px;
    border-left: 4px solid #f59e0b;
}

.calculator-disclaimer h4 {
    margin: 0 0 12px;
    color: #92400e;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.calculator-disclaimer p {
    margin: 0 0 12px;
    font-size: 13px;
    color: #78350f;
    line-height: 1.6;
}

.calculator-disclaimer p:last-child {
    margin-bottom: 0;
}

.calculator-disclaimer .sources {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(245, 158, 11, 0.3);
}

.calculator-disclaimer .sources h5 {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 600;
    color: #92400e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calculator-disclaimer .sources a {
    display: inline-block;
    font-size: 12px;
    color: #b45309;
    text-decoration: none;
    margin-bottom: 4px;
    margin-right: 16px;
}

.calculator-disclaimer .sources a:hover {
    text-decoration: underline;
}

.calculator-disclaimer .sources a i {
    margin-right: 4px;
    font-size: 10px;
}

.calculator-disclaimer .timestamp {
    margin-top: 12px;
    font-size: 11px;
    color: #a16207;
    font-style: italic;
}

/* ==================== Mobile Sidebar Toggle ==================== */
.mobile-sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #A81327, #8B0E1F);
    color: white;
    border: none;
    box-shadow: 0 4px 20px rgba(168, 19, 39, 0.4);
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
}

.mobile-sidebar-toggle:hover {
    transform: scale(1.1);
}

.mobile-sidebar-toggle i {
    font-size: 20px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.sidebar-overlay.active {
    display: block;
}

/* ==================== Responsive Styles ==================== */
@media (max-width: 1200px) {
    .calculator-wrapper {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .calculator-results {
        position: static;
        top: auto;
    }
}

@media (max-width: 992px) {
    .tools-sidebar {
        position: fixed;
        left: -300px;
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 1001;
        background: white;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
        transition: left 0.3s ease;
        border-radius: 0;
        max-height: 100vh;
        padding-top: 80px;
    }

    .tools-sidebar.active {
        left: 0;
    }

    .tools-sidebar-header {
        border-radius: 0;
    }

    .tools-sidebar-nav {
        border-radius: 0;
    }

    .mobile-sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .tools-main-wrapper {
        flex-direction: column;
    }

    /* Tablet-specific calculator fixes */
    .calculator-wrapper {
        gap: 20px;
    }

    .tool-page-wrapper {
        padding: 15px;
    }

    .calculator-form,
    .calculator-results {
        padding: 24px;
    }
}

@media (max-width: 768px) {
    body {
        padding-top: 70px;
    }

    .tools-hero {
        padding: 60px 20px 40px;
    }

    .tools-hero-title {
        font-size: 32px;
    }

    .tools-hero-subtitle {
        font-size: 16px;
    }

    .tools-search-input {
        padding: 14px 45px 14px 45px;
        font-size: 15px;
    }

    .ad-header .ad-placeholder,
    .ad-footer .ad-placeholder {
        width: 100%;
        height: 60px;
    }

    .ad-sidebar {
        display: none !important;
    }

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

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

    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .calculator-title {
        font-size: 24px;
        line-height: 1.3;
        margin-bottom: 10px;
    }

    .calculator-description {
        font-size: 14px;
        line-height: 1.5;
    }

    .calculator-container {
        padding: 15px 12px 20px 12px;
        max-width: 100%;
    }

    .calculator-wrapper {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .calculator-form {
        padding: 18px 14px;
        border-radius: 12px;
    }

    .calculator-results {
        padding: 18px 14px;
        border-radius: 12px;
        position: static !important;
        top: auto;
    }

    .results-main-value {
        font-size: 32px;
        word-break: break-word;
    }

    .results-header {
        margin-bottom: 16px;
        padding-bottom: 14px;
    }

    .results-header h3 {
        font-size: 12px;
    }

    .form-section {
        margin-bottom: 18px;
    }

    .form-section-title {
        font-size: 13px;
        margin: 0 0 12px 0;
    }

    .form-group {
        margin-bottom: 12px;
    }

    .form-group label {
        font-size: 13px;
        margin-bottom: 6px;
    }

    input[type="text"],
    input[type="number"],
    input[type="email"],
    select {
        font-size: 16px !important; /* Prevent iOS zoom on focus */
        padding: 12px 12px;
        border-radius: 8px;
        min-height: 44px; /* Touch target minimum */
    }

    .input-wrapper input.has-prefix {
        padding-left: 32px;
    }

    .input-wrapper input.has-suffix {
        padding-right: 32px;
    }

    .input-prefix,
    .input-suffix {
        font-size: 13px;
    }

    .calculate-btn {
        font-size: 15px;
        padding: 14px 20px;
        width: 100%;
        min-height: 48px;
        border-radius: 8px;
        margin-top: 4px;
    }

    /* Breadcrumb mobile fix */
    .calculator-breadcrumb {
        font-size: 11px;
        flex-wrap: wrap;
        word-break: break-word;
        margin-bottom: 12px;
    }

    .calculator-breadcrumb span {
        margin: 0 4px;
    }

    /* Results panel mobile */
    .results-section {
        padding: 14px;
    }

    .results-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .result-item {
        padding: 8px 0;
        font-size: 14px;
    }

    .result-label {
        font-size: 13px;
    }

    .result-value {
        font-size: 15px;
    }

    /* Amortization table responsive */
    .amortization-table-container.active {
        max-height: 400px;
    }

    .amortization-table {
        font-size: 12px;
    }

    .amortization-table th,
    .amortization-table td {
        padding: 8px 12px;
        font-size: 12px;
    }

    .amortization-toggle {
        padding: 14px 16px;
    }

    .amortization-toggle h4 {
        font-size: 14px;
        gap: 8px;
    }

    /* Related calculators grid */
    .related-calculators h3 {
        font-size: 18px;
    }

    /* Info section */
    .calculator-info {
        padding: 20px;
        border-radius: 12px;
        margin-top: 32px;
    }

    .calculator-info h3 {
        font-size: 18px;
        margin-bottom: 12px;
    }

    .calculator-info p,
    .calculator-info li {
        font-size: 14px;
    }

    .calculator-disclaimer {
        padding: 16px;
        margin-top: 24px;
    }

    .calculator-disclaimer h4 {
        font-size: 13px;
    }

    .calculator-disclaimer p {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    body {
        padding-top: 60px;
        font-size: 14px;
    }

    .tools-hero-title {
        font-size: 24px;
    }

    .tools-hero-subtitle {
        font-size: 13px;
    }

    .tool-card {
        padding: 14px;
        flex-direction: column;
        text-align: center;
    }

    .tool-card-icon {
        width: 40px;
        height: 40px;
    }

    .tool-card-icon i {
        font-size: 18px;
    }

    .tool-card-content h3,
    .tool-card-content h4 {
        font-size: 13px;
    }

    .tool-card-content p {
        font-size: 11px;
    }

    .tool-card-arrow {
        display: none;
    }

    /* Calculator page mobile optimizations */
    .calculator-title {
        font-size: 20px;
        line-height: 1.2;
        margin-bottom: 8px;
    }

    .calculator-description {
        font-size: 12px;
        line-height: 1.4;
        margin-bottom: 12px;
    }

    .calculator-breadcrumb {
        font-size: 10px;
        margin-bottom: 10px;
    }

    .calculator-breadcrumb a,
    .calculator-breadcrumb span {
        display: inline;
    }

    .calculator-container {
        padding: 12px 10px 16px 10px;
        max-width: 100%;
    }

    .calculator-wrapper {
        gap: 12px;
    }

    .calculator-form,
    .calculator-results {
        padding: 14px 12px;
        border-radius: 10px;
    }

    .calculator-form {
        background: #ffffff;
    }

    .calculator-results {
        position: static !important;
        top: auto !important;
        height: auto !important;
    }

    .form-section {
        margin-bottom: 14px;
    }

    .form-section-title {
        font-size: 12px;
        margin: 0 0 10px 0;
        text-transform: uppercase;
        letter-spacing: 0.3px;
    }

    .form-group {
        margin-bottom: 10px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .form-group label {
        font-size: 12px;
        margin-bottom: 4px;
        font-weight: 600;
    }

    .form-help {
        font-size: 11px;
        margin-top: 4px;
    }

    input[type="text"],
    input[type="number"],
    input[type="email"],
    select {
        font-size: 16px !important;
        padding: 11px 10px;
        border-radius: 8px;
        min-height: 44px;
        -webkit-appearance: none;
        -moz-appearance: none;
        appearance: none;
        background-color: #ffffff;
        border: 2px solid #e2e8f0;
    }

    .input-wrapper input.has-prefix {
        padding-left: 30px;
    }

    .input-wrapper input.has-suffix {
        padding-right: 30px;
    }

    .input-prefix,
    .input-suffix {
        font-size: 12px;
        left: 10px;
        right: 10px;
    }

    .input-prefix {
        left: 10px;
    }

    .input-suffix {
        right: 10px;
    }

    .calculate-btn {
        font-size: 14px;
        padding: 13px 16px;
        width: 100%;
        min-height: 46px;
        border-radius: 8px;
        margin-top: 6px;
        font-weight: 600;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
    }

    .calculate-btn i {
        font-size: 16px;
    }

    /* Results panel mobile */
    .results-main-value {
        font-size: 26px;
        word-break: break-word;
    }

    .results-header {
        margin-bottom: 12px;
        padding-bottom: 12px;
    }

    .results-header h3 {
        font-size: 11px;
        letter-spacing: 0.5px;
    }

    .results-header .results-frequency {
        font-size: 12px;
    }

    .results-details {
        gap: 8px;
    }

    .result-item {
        padding: 8px 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .result-item:last-child {
        border-bottom: none;
    }

    .result-label {
        font-size: 12px;
    }

    .result-value {
        font-size: 14px;
        font-weight: 600;
    }

    /* Amortization table */
    .amortization-toggle {
        padding: 12px 14px;
        font-size: 14px;
    }

    .amortization-toggle h4 {
        font-size: 13px;
        gap: 6px;
    }

    .amortization-toggle h4 i {
        font-size: 14px;
    }

    .amortization-table-container.active {
        max-height: 300px;
    }

    .amortization-table {
        font-size: 11px;
    }

    .amortization-table th,
    .amortization-table td {
        padding: 6px 8px;
        font-size: 11px;
    }

    .amortization-table th {
        font-size: 10px;
    }

    /* Related calculators */
    .related-calculators {
        margin-top: 32px;
        padding-top: 20px;
    }

    .related-calculators h3 {
        font-size: 16px;
        margin-bottom: 14px;
    }

    .tools-grid {
        gap: 12px;
    }

    .tool-card {
        padding: 12px;
    }

    /* Info section */
    .calculator-info {
        padding: 14px;
        margin-top: 24px;
    }

    .calculator-info h3 {
        font-size: 15px;
        margin-bottom: 10px;
        font-weight: 600;
    }

    .calculator-info p,
    .calculator-info li {
        font-size: 13px;
        line-height: 1.5;
    }

    .calculator-info ul {
        margin: 10px 0;
        padding-left: 20px;
    }

    .calculator-info li {
        margin-bottom: 6px;
    }

    /* Disclaimer */
    .calculator-disclaimer {
        padding: 12px;
        margin-top: 20px;
        border-radius: 10px;
    }

    .calculator-disclaimer h4 {
        font-size: 12px;
        margin-bottom: 8px;
        gap: 6px;
    }

    .calculator-disclaimer h4 i {
        font-size: 12px;
    }

    .calculator-disclaimer p {
        font-size: 11px;
        margin-bottom: 8px;
        line-height: 1.5;
    }

    .calculator-disclaimer .sources {
        margin-top: 10px;
        padding-top: 10px;
    }

    .calculator-disclaimer .sources h5 {
        font-size: 11px;
        margin-bottom: 6px;
    }

    .calculator-disclaimer .sources a {
        display: block;
        font-size: 11px;
        margin-bottom: 6px;
        margin-right: 0;
    }

    .calculator-disclaimer .timestamp {
        font-size: 10px;
        margin-top: 8px;
    }

    /* Ad containers */
    .ad-header,
    .ad-footer {
        padding: 10px;
    }

    .ad-header .ad-placeholder,
    .ad-footer .ad-placeholder {
        width: 100%;
        height: 50px;
        font-size: 10px;
    }

    .tool-page-wrapper {
        padding: 8px;
        gap: 8px;
    }

    .ad-sidebar {
        display: none !important;
    }
}

/* ==================== Toast Notifications ==================== */
.tools-toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #1e293b;
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    max-width: 400px;
}

.tools-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.tools-toast i {
    font-size: 20px;
}

.tools-toast-success {
    background: linear-gradient(135deg, #059669, #047857);
}

.tools-toast-error {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.tools-toast-warning {
    background: linear-gradient(135deg, #d97706, #b45309);
}

.tools-toast-info {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
}

/* ==================== Tool Hero Section (for individual tools) ==================== */
.tool-hero {
    background: linear-gradient(135deg, #A81327 0%, #8B0E1F 50%, #121212 100%);
    padding: 60px 20px 40px;
    text-align: center;
    position: relative;
}

.tool-hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.tool-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
}

.tool-hero h1 {
    font-size: 36px;
    font-weight: 800;
    color: white;
    margin: 0 0 12px;
}

.tool-hero p {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.85);
    margin: 0;
    line-height: 1.6;
}

/* ==================== Drop Zone Styles ==================== */
.drop-zone {
    border: 2px dashed #cbd5e1;
    border-radius: 16px;
    padding: 48px 24px;
    text-align: center;
    background: #f8fafc;
    transition: all 0.3s ease;
    cursor: pointer;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: #A81327;
    background: rgba(168, 19, 39, 0.05);
}

.drop-zone-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, rgba(168, 19, 39, 0.1), rgba(168, 19, 39, 0.05));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drop-zone-icon i {
    font-size: 32px;
    color: #A81327;
}

.drop-zone h3 {
    margin: 0 0 8px;
    font-size: 18px;
    color: #334155;
}

.drop-zone p {
    margin: 0;
    font-size: 14px;
    color: #64748b;
}

.drop-zone input[type="file"] {
    display: none;
}

/* ==================== Preview Panel ==================== */
.preview-panel {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    margin-top: 24px;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.preview-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #334155;
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-header h3 i {
    color: #A81327;
}

.preview-actions {
    display: flex;
    gap: 8px;
}

.preview-content {
    min-height: 200px;
}

/* ==================== Action Buttons ==================== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #A81327, #8B0E1F);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(168, 19, 39, 0.3);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    color: #334155;
    background: #f1f5f9;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-success {
    background: linear-gradient(135deg, #059669, #047857);
}

.btn-success:hover {
    box-shadow: 0 8px 25px rgba(5, 150, 105, 0.3);
}

/* ==================== Output Box ==================== */
.output-box {
    background: #1e293b;
    border-radius: 12px;
    padding: 20px;
    position: relative;
}

.output-box pre {
    margin: 0;
    color: #e2e8f0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
}

.output-box .copy-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
}

.output-box .copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.output-box .copy-btn.copied {
    background: #059669;
}

/* ==================== Input/Output Split Layout ==================== */
.split-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 992px) {
    .split-layout {
        grid-template-columns: 1fr;
    }
}

.split-panel {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.split-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.split-panel-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #334155;
}

.split-panel textarea {
    width: 100%;
    min-height: 300px;
    padding: 16px;
    font-size: 14px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s ease;
}

.split-panel textarea:focus {
    border-color: #A81327;
}

/* ==================== Stats Display ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.stat-card {
    background: #f8fafc;
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #A81327;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ==================== Options Panel ==================== */
.options-panel {
    background: #f8fafc;
    border-radius: 12px;
    padding: 20px;
    margin-top: 20px;
}

.options-title {
    font-size: 14px;
    font-weight: 600;
    color: #334155;
    margin: 0 0 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.options-title i {
    color: #A81327;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.option-group label {
    font-size: 13px;
    font-weight: 500;
    color: #475569;
}

.option-group select,
.option-group input {
    padding: 10px 14px;
    font-size: 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s ease;
}

.option-group select:focus,
.option-group input:focus {
    border-color: #A81327;
}

/* ==================== Checkbox/Toggle Styles ==================== */
.toggle-option {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.toggle-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #A81327;
}

.toggle-option span {
    font-size: 14px;
    color: #334155;
}

/* ==================== File List ==================== */
.file-list {
    margin-top: 20px;
}

.file-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 8px;
}

.file-item:last-child {
    margin-bottom: 0;
}

.file-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, rgba(168, 19, 39, 0.1), rgba(168, 19, 39, 0.05));
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #A81327;
}

.file-info {
    flex: 1;
}

.file-name {
    font-size: 14px;
    font-weight: 500;
    color: #334155;
    margin-bottom: 2px;
}

.file-size {
    font-size: 12px;
    color: #64748b;
}

.file-actions {
    display: flex;
    gap: 8px;
}

.file-actions button {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.file-actions .remove-btn {
    background: #fef2f2;
    color: #dc2626;
}

.file-actions .remove-btn:hover {
    background: #fee2e2;
}

/* ==================== Progress Bar ==================== */
.progress-container {
    margin-top: 20px;
}

.progress-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #A81327, #8B0E1F);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 13px;
    color: #64748b;
}

/* ==================== Color Picker Styles ==================== */
.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-picker-wrapper input[type="color"] {
    width: 50px;
    height: 40px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    padding: 2px;
}

.color-picker-wrapper input[type="text"] {
    flex: 1;
    padding: 10px 14px;
    font-size: 14px;
    font-family: monospace;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    text-transform: uppercase;
}

/* ==================== Tabs ==================== */
.tabs-container {
    margin-bottom: 24px;
}

.tabs-header {
    display: flex;
    gap: 4px;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 10px;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: #334155;
}

.tab-btn.active {
    background: white;
    color: #A81327;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.tab-content {
    display: none;
}

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

/* ==================== QR Code Display ==================== */
.qr-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

.qr-code-container {
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
}

.qr-code-container canvas,
.qr-code-container img {
    display: block;
}

/* ==================== Image Preview Grid ==================== */
.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.image-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    background: #f1f5f9;
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-item .overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.image-preview-item:hover .overlay {
    opacity: 1;
}

.image-preview-item .overlay button {
    background: white;
    color: #334155;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    margin: 0 4px;
}

/* ==================== Tool Layout with Sidebar Ads ==================== */
.tool-page-wrapper {
    display: flex;
    max-width: 1600px;
    margin: 0 auto;
    gap: 20px;
    padding: 20px;
    min-height: calc(100vh - 200px);
}

.ad-sidebar {
    width: 160px;
    flex-shrink: 0;
    position: sticky;
    top: 110px;
    height: fit-content;
    align-self: flex-start;
}

.ad-sidebar .ad-placeholder {
    width: 160px;
    min-height: 600px;
    background: linear-gradient(145deg, #f8fafc 0%, #f1f5f9 100%);
    border: 2px dashed #e2e8f0;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 12px;
    text-align: center;
    padding: 20px 10px;
}

.ad-sidebar .ad-placeholder::before {
    content: '\f0a1';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 24px;
    margin-bottom: 10px;
    opacity: 0.5;
}

.ad-sidebar .ad-label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 8px;
    color: #94a3b8;
}

.tool-main-content {
    flex: 1;
    min-width: 0;
    max-width: 900px;
    margin: 0 auto;
}

/* Wide layout for tools that need more space */
.tool-page-wrapper.wide .tool-main-content {
    max-width: 1100px;
}

/* Responsive: Hide sidebars on smaller screens */
@media (max-width: 1200px) {
    .ad-sidebar {
        display: none;
    }

    .tool-page-wrapper {
        padding: 10px;
    }

    .tool-main-content {
        max-width: 100%;
    }
}

/* Medium screens - show only one sidebar */
@media (min-width: 1201px) and (max-width: 1400px) {
    .ad-sidebar.ad-sidebar-left {
        display: none;
    }

    .tool-page-wrapper {
        justify-content: center;
    }
}

/* Large screens - show both sidebars */
@media (min-width: 1401px) {
    .ad-sidebar {
        display: block;
    }
}

/* ==================== TABLET MOBILE FIXES (768px) ==================== */
@media (max-width: 768px) {
    /* Tool Hero adjustments */
    .tool-hero {
        padding: 40px 15px 30px;
        margin-bottom: 20px;
    }

    .tool-hero h1 {
        font-size: 28px;
        margin: 0 0 10px;
    }

    .tool-hero p {
        font-size: 15px;
    }

    /* Drop zones */
    .drop-zone {
        padding: 2rem 1rem;
        margin-bottom: 1.5rem;
    }

    .drop-zone-icon {
        font-size: 3rem;
        margin-bottom: 0.75rem;
    }

    /* Controls section - reduce padding */
    .controls-section {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }

    /* Preview grids */
    .preview-section {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        margin-bottom: 1.5rem;
    }

    .preview-card {
        padding: 1rem;
    }

    .preview-image {
        height: 250px;
    }

    /* Action buttons stack */
    .action-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }

    .action-buttons .btn {
        width: 100%;
    }

    /* Batch list items */
    .batch-item {
        flex-wrap: wrap;
        padding: 0.75rem;
    }

    .batch-item-info {
        flex: 1 1 100%;
        margin-bottom: 0.5rem;
    }

    .remove-btn {
        flex: 1;
        margin-top: 0.5rem;
        min-width: auto;
    }

    /* Educational content */
    .educational-content {
        padding: 1.5rem;
        margin: 1.5rem 0;
    }

    .educational-content ul {
        margin-left: 1.5rem;
    }

    /* Related tools grid */
    .related-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Ad spaces */
    .ad-space {
        padding: 1.5rem;
        min-height: 150px;
        margin: 1.5rem 0;
    }
}

/* ==================== MOBILE FIXES (480px) ==================== */
@media (max-width: 480px) {
    /* Tool Hero - minimal padding */
    .tool-hero {
        padding: 30px 12px 20px;
        margin-bottom: 15px;
    }

    .tool-hero h1 {
        font-size: 24px;
        margin: 0 0 8px;
    }

    .tool-hero p {
        font-size: 14px;
        line-height: 1.5;
    }

    /* Drop zone - mobile friendly */
    .drop-zone {
        padding: 1.5rem 1rem;
        margin-bottom: 1rem;
        border-radius: 10px;
    }

    .drop-zone-icon {
        font-size: 2.5rem;
        margin-bottom: 0.5rem;
    }

    .drop-zone-text {
        font-size: 16px;
    }

    .drop-zone-subtext {
        font-size: 13px;
    }

    /* Controls - tighter spacing */
    .controls-section {
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: 10px;
    }

    .control-group {
        margin-bottom: 1rem;
    }

    .control-group label {
        font-size: 13px;
        margin-bottom: 0.4rem;
    }

    /* Format selector layout for small screens */
    .format-selector {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-bottom: 1rem;
    }

    .arrow-icon {
        display: none;
    }

    .format-card {
        padding: 1rem;
    }

    .format-card h3 {
        font-size: 14px;
        margin-bottom: 0.75rem;
    }

    .format-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.3rem;
    }

    .format-btn {
        padding: 0.6rem 0.5rem;
        font-size: 12px;
    }

    /* Preview cards stack */
    .preview-section {
        grid-template-columns: 1fr;
        gap: 1rem;
        margin-bottom: 1rem;
    }

    .preview-card {
        padding: 0.75rem;
        border-radius: 10px;
    }

    .preview-card h3 {
        font-size: 14px;
        margin-bottom: 0.75rem;
    }

    .preview-image {
        height: 200px;
        border-radius: 6px;
        margin-bottom: 0.75rem;
    }

    .stat-item {
        padding: 0.4rem;
        font-size: 12px;
    }

    /* Action buttons - full width */
    .action-buttons {
        flex-direction: column;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    .action-buttons .btn {
        width: 100%;
        padding: 0.6rem 1rem;
        font-size: 14px;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }

    /* Batch list - mobile optimized */
    .batch-list {
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: 10px;
    }

    .batch-list h3 {
        font-size: 14px;
        margin-bottom: 0.75rem;
    }

    .batch-item {
        flex-direction: column;
        padding: 0.75rem;
        margin-bottom: 0.5rem;
    }

    .batch-item-info {
        width: 100%;
        margin-bottom: 0.5rem;
    }

    .batch-item-name {
        font-size: 13px;
    }

    .batch-item-stats {
        font-size: 12px;
    }

    .remove-btn {
        width: 100%;
        padding: 0.5rem;
        font-size: 12px;
    }

    /* Slider container */
    .slider-container {
        gap: 0.75rem;
        flex-wrap: wrap;
    }

    .quality-value {
        min-width: 50px;
        font-size: 14px;
    }

    input[type="range"] {
        height: 5px;
    }

    /* Educational content */
    .educational-content {
        padding: 1rem;
        margin: 1rem 0;
        border-radius: 10px;
    }

    .educational-content h2 {
        font-size: 18px;
        margin-bottom: 0.75rem;
    }

    .educational-content h3 {
        font-size: 15px;
        margin-top: 1rem;
        margin-bottom: 0.5rem;
    }

    .educational-content p {
        font-size: 14px;
        line-height: 1.5;
        margin-bottom: 0.75rem;
    }

    .educational-content ul {
        margin-left: 1.25rem;
        padding-left: 0;
    }

    .educational-content li {
        font-size: 13px;
        margin-bottom: 0.5rem;
    }

    /* Related tools */
    .related-tools {
        padding: 1rem;
        margin: 1rem 0;
        border-radius: 10px;
    }

    .related-tools h2 {
        font-size: 18px;
        margin-bottom: 1rem;
    }

    .related-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }

    .related-tool-card {
        padding: 1rem;
        border-radius: 8px;
    }

    .related-tool-card h3 {
        font-size: 14px;
        margin-bottom: 0.4rem;
    }

    .related-tool-card p {
        font-size: 12px;
    }

    /* Ad space */
    .ad-space {
        padding: 1rem;
        margin: 1rem 0;
        min-height: 100px;
        border-radius: 10px;
    }

    /* Crop workspace adjustments */
    .crop-workspace {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .crop-canvas-container {
        padding: 1rem;
        min-height: 300px;
    }

    .crop-controls {
        padding: 1rem;
    }

    .control-section {
        margin-bottom: 1rem;
    }

    .control-section h3 {
        font-size: 14px;
        margin-bottom: 0.75rem;
    }

    .aspect-ratio-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.4rem;
    }

    .aspect-btn {
        padding: 0.6rem;
        font-size: 12px;
    }

    .dimension-inputs {
        gap: 0.75rem;
    }

    .input-group input {
        padding: 0.6rem;
        font-size: 14px;
    }

    .crop-info {
        padding: 0.75rem;
        font-size: 12px;
    }

    /* Filter grid */
    .filter-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        margin-bottom: 1.5rem;
    }

    .filter-btn {
        padding: 0.75rem;
        font-size: 12px;
    }

    .filter-preview {
        height: 60px;
        margin-bottom: 0.5rem;
    }

    /* Rotate/Flip buttons */
    .button-group {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .btn-control {
        padding: 0.6rem;
        font-size: 13px;
    }

    /* Input field sizing */
    input[type="text"],
    input[type="number"],
    input[type="color"],
    select {
        padding: 0.6rem;
        font-size: 16px !important;
    }

    /* Position grid (crop, watermark) */
    .position-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.4rem;
    }

    .position-btn,
    .logo-position-btn {
        padding: 0.5rem;
        font-size: 16px;
    }

    /* Canvas container */
    .canvas-container {
        max-width: 100%;
        overflow-x: auto;
    }

    #canvas,
    #cropCanvas {
        max-width: 100%;
        height: auto;
    }

    /* Tab buttons */
    .control-tabs {
        display: flex;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    .tab-btn {
        flex: 1;
        padding: 0.6rem;
        font-size: 13px;
    }

    /* Transform info */
    .transform-info {
        padding: 0.75rem;
        font-size: 12px;
        margin: 0.75rem 0;
    }

    /* Quality control */
    .quality-control {
        padding: 1rem;
        margin-bottom: 1rem;
    }

    .quality-control label {
        font-size: 13px;
        margin-bottom: 0.5rem;
    }

    /* Download section */
    .download-section {
        max-width: 100%;
        margin: 0;
    }
}
