/* =========================================
   1. GLOBAL VARIABLES & MERGED ROOT
   ========================================= */
:root {
    /* --- Brand Colors --- */
    --primary: #F97316;
    --primary-hover: #EA580C;
    --secondary: #E11D48;
    --dark-bg: #020617;
    --card-bg: #0F172A;
    --text-main: #F8FAFC;
    --text-muted: #94A3B8;
    --primary-rgb: 249, 115, 22;

    /* --- Studio Specifics --- */
    --panel-width: 320px;
    --header-height: 70px;
    --studio-bg: #0a0a0a;
    --panel-bg: rgba(20, 20, 20, 0.95);
    --canvas-bg: #121212;
    --border-color: rgba(255, 255, 255, 0.1);
    --radius-md: 8px;
    --radius-lg: 16px;
}


/* =========================================
   2. STUDIO LAYOUT GRID (3-Column)
   ========================================= */
.studio-wrapper {
    display: grid;
    /* Left Panel | Center Canvas | Right Panel */
    grid-template-columns: var(--panel-width) 1fr var(--panel-width);
    grid-template-rows: calc(100vh - var(--header-height) - 40px);
    gap: 16px;
    padding: 0 20px 20px 20px;
    box-sizing: border-box;
    overflow: hidden;
    margin-top: 100px;
    /* Adjusted spacing from navbar */
}

/* Common Panel Styles */
.studio-panel {
    display: flex;
    flex-direction: column;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.panel-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
}

.panel-header h3 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.panel-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background: rgba(0, 0, 0, 0.2);
}

/* Custom Scrollbar */
.custom-scrollbar::-webkit-scrollbar {
    width: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* =========================================
   3. CENTER CANVAS (FIXED PREVIEW)
   ========================================= */
.studio-canvas {
    background-color: var(--canvas-bg);
    /* Checkerboard pattern */
    background-image:
        linear-gradient(45deg, #1a1a1a 25%, transparent 25%),
        linear-gradient(-45deg, #1a1a1a 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #1a1a1a 75%),
        linear-gradient(-45deg, transparent 75%, #1a1a1a 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
}

.canvas-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    position: relative;
}

/* Initial Upload Area */
.upload-area-large {
    text-align: center;
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 60px;
    transition: all 0.3s ease;
    background: rgba(0, 0, 0, 0.4);
    cursor: pointer;
}

.upload-area-large:hover {
    border-color: var(--primary);
    background: rgba(var(--primary-rgb), 0.05);
    transform: scale(1.02);
}

.upload-icon-large {
    font-size: 5rem;
    color: rgba(255, 255, 255, 0.2);
    margin-bottom: 24px;
}

.upload-area-large:hover .upload-icon-large {
    color: var(--primary);
}

/* Preview Stage */
.preview-stage {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.collage-preview-wrapper {
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.3s ease;
    display: flex;
    justify-content: center;
}

.collage-image {
    max-height: calc(100vh - 250px);
    max-width: 100%;
    object-fit: contain;
    display: block;
}

/* FIXED: Canvas Placeholder Visibility */
.canvas-placeholder {
    color: var(--text-muted);
    text-align: center;
    opacity: 0.9;
    border: 2px dashed rgba(255, 255, 255, 0.15);
    padding: 40px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

/* =========================================
   4. LEFT PANEL (Assets & Layouts)
   ========================================= */
.image-stack-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.image-preview-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    padding: 8px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s;
}

.image-preview-row:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(4px);
}

.mini-thumb {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    object-fit: cover;
    background: #000;
}

.row-info {
    flex: 1;
    font-size: 0.85rem;
    color: #ccc;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-remove-row {
    color: #ef4444;
    background: transparent;
    border: none;
    padding: 6px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.btn-remove-row:hover {
    opacity: 1;
}

.btn-mini-add {
    width: 100%;
    padding: 8px;
    border: 1px dashed rgba(255, 255, 255, 0.2);
    background: transparent;
    color: var(--text-muted);
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-mini-add:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(var(--primary-rgb), 0.1);
}

/* FIXED: Layout Grid Wireframes */
.layout-grid-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 12px;
}

.layout-thumb {
    aspect-ratio: 1;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px;
    position: relative;
}

.layout-thumb:hover {
    border-color: rgba(var(--primary-rgb), 0.5);
}

.layout-thumb.selected {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

/* The container for the grid cells */
.wireframe-box {
    width: 100%;
    height: 100%;
    display: grid;
    gap: 2px;
    pointer-events: none;
}

/* The actual cells - giving them color so they aren't invisible against black */
.wf-cell {
    background: rgba(255, 255, 255, 0.15);
    /* Visible grey */
    border-radius: 2px;
    width: 100%;
    height: 100%;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.layout-thumb.selected .wf-cell {
    background: rgba(var(--primary-rgb), 0.4);
    /* Orange tint */
    border-color: rgba(var(--primary-rgb), 0.5);
}

/* =========================================
   5. RIGHT PANEL (FIXED CUSTOM DROPDOWNS)
   ========================================= */
.section-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.badge {
    background: var(--primary);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
}

.slider-group {
    margin-bottom: 20px;
}

.slider-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: #eee;
}

.slider-val {
    color: var(--primary);
    font-weight: bold;
    background: rgba(var(--primary-rgb), 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8rem;
}

/* Sliders */
.range-slider {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    outline: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    transition: transform 0.1s;
}

.range-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* --- CUSTOM DROPDOWNS (The Orange/Black Theme) --- */
.custom-input-group {
    position: relative;
    margin-bottom: 16px;
}

.sub-label {
    display: block;
    font-size: 0.85rem;
    color: #ccc;
    margin-bottom: 6px;
}

.custom-select {
    position: relative;
    width: 100%;
    font-size: 0.9rem;
    user-select: none;
}

/* The box you click - FIXED */
.select-trigger {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #1a1a1a !important;
    /* Force Solid Dark Background */
    background-image: none !important;
    /* CRITICAL: Removes inherited checkerboard */
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s;
}

.select-trigger:hover {
    border-color: var(--primary);
    background: #252525 !important;
}

.custom-select.open .select-trigger {
    border-color: var(--primary);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

/* The list of options */
.select-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1a1a1a;
    border: 1px solid var(--primary);
    border-top: none;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    z-index: 100;
    display: none;
    /* Expand fully; let the panel content handle scrolling */
    max-height: none;
    overflow: visible;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.custom-select.open .select-options {
    display: block;
}

/* Individual Option */
.option {
    padding: 10px 16px;
    cursor: pointer;
    color: #ccc;
    transition: background 0.2s;
}

.option:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Selected Option Style (Orange Background) */
.option.selected {
    background: var(--primary);
    color: white;
    font-weight: 600;
}

/* Info Box Empty */
.info-box-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    opacity: 0.6;
}

.info-box-empty i {
    font-size: 2rem;
    margin-bottom: 10px;
    display: block;
}

/* =========================================
   6. UTILITY & RESPONSIVE
   ========================================= */
.panel-divider {
    border: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 20px 0;
}

.cost-indicator {
    font-size: 0.85rem;
    color: #ffd700;
    text-align: center;
    margin-bottom: 12px;
}

.btn-full,
.btn-block {
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

/* === SPECIFIC DOWNLOAD BUTTON STYLE (Gradient Orange/Red) === */
/* === DOWNLOAD BUTTON (Gradient) === */
#downloadBtn {
    background: linear-gradient(135deg, #F97316 0%, #db2777 100%) !important;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s;
}

#downloadBtn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(249, 115, 22, 0.6);
}

/* Loading Spinner for Button */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: btn-spin 0.8s linear infinite;
}

@keyframes btn-spin {
    100% {
        transform: rotate(360deg);
    }
}

/* Floating Progress */
.progress-container-floating {
    position: absolute;
    background: rgba(0, 0, 0, 0.85);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    z-index: 20;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.loader-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

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

/* =========================================
   RESPONSIVE MEDIA QUERIES
   ========================================= */

/* Extra Small Devices (320px - 480px) */
@media (max-width: 480px) {
    :root {
        --panel-width: 100%;
        --header-height: 60px;
    }

    .studio-wrapper {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 0 12px 12px 12px;
        margin-top: 70px;
        height: auto;
        overflow: visible;
    }

    /* Canvas First */
    .studio-canvas {
        order: 1;
        height: 300px;
        min-height: 300px;
        border-radius: 12px;
    }

    .canvas-container {
        padding: 20px;
    }

    .upload-area-large {
        padding: 30px 20px;
        border-radius: 12px;
    }

    .upload-icon-large {
        font-size: 3rem;
        margin-bottom: 16px;
    }

    .upload-area-large h2 {
        font-size: 1.2rem;
    }

    .upload-area-large p {
        font-size: 0.85rem;
    }

    .collage-image {
        max-height: 250px;
    }

    /* Left Panel Second */
    .studio-panel:first-of-type {
        order: 2;
        height: auto;
        min-height: auto;
    }

    /* Right Panel Third */
    .studio-panel:last-of-type {
        order: 3;
        height: auto;
        min-height: auto;
    }

    /* Panel Headers */
    .panel-header {
        padding: 12px 16px;
    }

    .panel-header h3 {
        font-size: 0.9rem;
    }

    .panel-content {
        padding: 16px;
    }

    .panel-footer {
        padding: 16px;
    }

    /* Image Grid - Horizontal Scroll */
    .image-stack-container {
        display: flex;
        flex-direction: row;
        gap: 8px;
        overflow-x: auto;
        overflow-y: hidden;
        padding-bottom: 8px;
        -webkit-overflow-scrolling: touch;
    }

    .image-preview-row {
        min-width: 140px;
        flex-shrink: 0;
        flex-direction: column;
        text-align: center;
        padding: 10px;
    }

    .mini-thumb {
        width: 60px;
        height: 60px;
        margin: 0 auto 8px;
    }

    .row-info {
        font-size: 0.75rem;
        text-align: center;
    }

    /* Layout Grid */
    .layout-grid-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .layout-thumb {
        padding: 6px;
    }

    /* Sliders */
    .slider-group {
        margin-bottom: 16px;
    }

    .slider-label {
        font-size: 0.85rem;
    }

    /* Buttons */
    .btn-primary,
    .btn-full,
    .btn-block {
        padding: 12px 16px;
        font-size: 0.9rem;
    }

    .btn-mini-add {
        padding: 10px;
        font-size: 0.8rem;
    }

    /* Custom Dropdowns */
    .select-trigger {
        padding: 10px 14px;
        font-size: 0.85rem;
    }

    .option {
        padding: 10px 14px;
        font-size: 0.85rem;
    }

    /* Progress Container */
    .progress-container-floating {
        padding: 16px;
        max-width: 90%;
    }

    /* Canvas Placeholder */
    .canvas-placeholder {
        padding: 30px 20px;
        font-size: 0.9rem;
    }

    .canvas-placeholder i {
        font-size: 2rem;
    }

    /* Section Labels */
    .section-label {
        font-size: 0.7rem;
        margin-bottom: 10px;
    }

    .badge {
        font-size: 0.65rem;
        padding: 2px 5px;
    }

    /* Cost Indicator */
    .cost-indicator {
        font-size: 0.8rem;
        margin-bottom: 10px;
    }
}

/* Tiny Devices (320px - 374px) */
@media (max-width: 374px) {
    .studio-wrapper {
        padding: 0 8px 8px 8px;
        gap: 10px;
        margin-top: 60px;
    }

    .studio-canvas {
        height: 280px;
        min-height: 280px;
    }

    .canvas-container {
        padding: 15px;
    }

    .upload-area-large {
        padding: 25px 15px;
    }

    .upload-icon-large {
        font-size: 2.5rem;
        margin-bottom: 12px;
    }

    .upload-area-large h2 {
        font-size: 1.1rem;
        margin-bottom: 8px;
    }

    .upload-area-large p {
        font-size: 0.8rem;
    }

    .upload-area-large .btn {
        padding: 10px 20px;
        font-size: 0.85rem;
    }

    .collage-image {
        max-height: 220px;
    }

    .panel-header {
        padding: 10px 12px;
    }

    .panel-header h3 {
        font-size: 0.85rem;
        gap: 6px;
    }

    .panel-content {
        padding: 12px;
    }

    .panel-footer {
        padding: 12px;
    }

    .image-preview-row {
        min-width: 120px;
        padding: 8px;
    }

    .mini-thumb {
        width: 50px;
        height: 50px;
    }

    .row-info {
        font-size: 0.7rem;
    }

    .btn-remove-row {
        padding: 4px;
        font-size: 0.8rem;
    }

    .layout-grid-container {
        gap: 6px;
    }

    .layout-thumb {
        padding: 4px;
        border-radius: 6px;
    }

    .wf-cell {
        border-radius: 1px;
    }

    .slider-label {
        font-size: 0.8rem;
    }

    .slider-val {
        font-size: 0.75rem;
        padding: 1px 5px;
    }

    .range-slider {
        height: 3px;
    }

    .range-slider::-webkit-slider-thumb {
        width: 14px;
        height: 14px;
    }

    .btn-primary,
    .btn-full,
    .btn-block {
        padding: 10px 14px;
        font-size: 0.85rem;
    }

    .btn-mini-add {
        padding: 8px;
        font-size: 0.75rem;
    }

    .select-trigger {
        padding: 9px 12px;
        font-size: 0.8rem;
    }

    .option {
        padding: 9px 12px;
        font-size: 0.8rem;
    }

    .progress-container-floating {
        padding: 12px;
        border-radius: 8px;
    }

    .loader-spinner {
        width: 24px;
        height: 24px;
        border-width: 2px;
        margin-bottom: 8px;
    }

    .progress-text {
        font-size: 0.8rem;
    }

    .canvas-placeholder {
        padding: 25px 15px;
        font-size: 0.85rem;
    }

    .canvas-placeholder i {
        font-size: 1.8rem;
        margin-bottom: 10px;
    }

    .section-label {
        font-size: 0.65rem;
        margin-bottom: 8px;
    }

    .badge {
        font-size: 0.6rem;
        padding: 1px 4px;
    }

    .cost-indicator {
        font-size: 0.75rem;
        margin-bottom: 8px;
    }

    .sub-label {
        font-size: 0.8rem;
        margin-bottom: 5px;
    }

    .custom-input-group {
        margin-bottom: 12px;
    }

    .panel-divider {
        margin: 15px 0;
    }

    #downloadBtn {
        padding: 10px;
        font-size: 0.85rem;
        gap: 8px;
    }

    #regenerateBtn {
        padding: 9px;
        font-size: 0.85rem;
    }

    .info-box-empty {
        padding: 30px 15px;
        font-size: 0.85rem;
    }

    .info-box-empty i {
        font-size: 1.8rem;
        margin-bottom: 8px;
    }
}

/* Small Tablets (481px - 767px) */
@media (min-width: 481px) and (max-width: 767px) {
    .studio-wrapper {
        display: flex;
        flex-direction: column;
        gap: 14px;
        padding: 0 16px 16px 16px;
        margin-top: 80px;
        height: auto;
        overflow: visible;
    }

    .studio-canvas {
        order: 1;
        height: 400px;
        min-height: 400px;
    }

    .studio-panel:first-of-type {
        order: 2;
        height: auto;
    }

    .studio-panel:last-of-type {
        order: 3;
        height: auto;
    }

    .canvas-container {
        padding: 30px;
    }

    .collage-image {
        max-height: 350px;
    }

    .image-stack-container {
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        gap: 10px;
    }

    .image-preview-row {
        min-width: 150px;
        flex-shrink: 0;
    }

    .layout-grid-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
}

/* Medium Tablets (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .studio-wrapper {
        grid-template-columns: 280px 1fr 280px;
        gap: 14px;
        padding: 0 16px 16px 16px;
        margin-top: 90px;
    }

    .layout-grid-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .panel-content {
        padding: 18px;
    }

    .canvas-container {
        padding: 35px;
    }
}

/* Large Tablets/Small Desktops (1024px - 1279px) */
@media (min-width: 1024px) and (max-width: 1279px) {
    .studio-wrapper {
        grid-template-columns: 280px 1fr 280px;
        gap: 14px;
        padding: 0 16px 16px 16px;
    }

    .layout-grid-container {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Standard Desktops (1280px+) - Default styles apply */
@media (min-width: 1280px) {
    .studio-wrapper {
        grid-template-columns: var(--panel-width) 1fr var(--panel-width);
    }
}

/* Landscape Orientation for Mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .studio-wrapper {
        margin-top: 60px;
    }

    .studio-canvas {
        height: 250px;
        min-height: 250px;
    }

    .collage-image {
        max-height: 200px;
    }

    .upload-area-large {
        padding: 20px 15px;
    }

    .upload-icon-large {
        font-size: 2.5rem;
    }
}

/* =========================================
   INTERNAL LINK STYLES - SEO & UX
   ========================================= */
.internal-link,
a.internal-link {
    color: var(--primary);
    text-decoration: none;
    position: relative;
    transition: color 0.3s ease;
    border-bottom: 1px solid transparent;
    padding-bottom: 1px;
}

.internal-link:hover,
a.internal-link:hover {
    color: var(--primary-hover);
    border-bottom-color: var(--primary);
}

.internal-link:focus,
a.internal-link:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Inline content links (within paragraphs) */
p .internal-link,
.tool-desc .internal-link,
.footer-tagline .internal-link {
    font-weight: 500;
    border-bottom: 1px dotted rgba(249, 115, 22, 0.4);
}

p .internal-link:hover,
.tool-desc .internal-link:hover,
.footer-tagline .internal-link:hover {
    border-bottom-style: solid;
    border-bottom-color: var(--primary);
}

/* Related tools section */
.related-tools {
    margin-top: 2rem;
    padding: 1.5rem;
    background: rgba(249, 115, 22, 0.05);
    border-left: 3px solid var(--primary);
    border-radius: 8px;
}

.related-tools h3 {
    font-size: 1rem;
    color: var(--primary);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.related-tools-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.related-tool-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(249, 115, 22, 0.1);
    border: 1px solid rgba(249, 115, 22, 0.2);
    border-radius: 20px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.related-tool-link:hover {
    background: rgba(249, 115, 22, 0.2);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.2);
}

.related-tool-link i {
    font-size: 0.875rem;
    color: var(--primary);
}