/* ============================================
   Converter Page Specific Styles
   ============================================ */

/* ============================================
   PAGE HEADER
   ============================================ */
.page-header {
    padding: var(--space-12) 0 var(--space-8);
    text-align: center;
    background: linear-gradient(135deg, var(--primary-50), var(--neutral-50));
    border-bottom: 1px solid var(--border-color);
}

[data-theme="dark"] .page-header {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.1), var(--bg-secondary));
}

.format-icons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-6);
    margin-bottom: var(--space-6);
}

.format-icons img {
    width: 64px;
    height: 64px;
    object-fit: contain;
}

.format-icon-large {
    font-size: 40px;
    line-height: 1;
}

.format-icons .arrow svg {
    width: 24px;
    height: 24px;
    color: var(--primary-500);
}

.page-header h1 {
    font-size: var(--text-4xl);
    margin-bottom: var(--space-3);
    background: linear-gradient(135deg, var(--primary-600), var(--primary-700));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tagline {
    font-size: var(--text-lg);
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* ============================================
   UPLOAD SECTION
   ============================================ */
.upload-section {
    margin-bottom: var(--space-8);
}

.dropzone {
    padding: var(--space-12);
    text-align: center;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-xl);
    background-color: var(--bg-secondary);
    transition: all var(--transition-normal);
    cursor: pointer;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--primary-500);
    background-color: var(--primary-50);
    transform: scale(1.02);
}

[data-theme="dark"] .dropzone:hover,
[data-theme="dark"] .dropzone.dragover {
    background-color: rgba(14, 165, 233, 0.1);
}

.upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-4);
    color: var(--primary-500);
}

.dropzone p {
    font-size: var(--text-lg);
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}


.dropzone-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    margin-bottom: var(--space-2);
}

.paste-area-btn {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--primary-600);
    cursor: pointer;
    border-bottom: 2px dashed var(--primary-300);
    transition: all var(--transition-fast);
}

.paste-area-btn:hover {
    color: var(--primary-700);
    border-bottom-color: var(--primary-600);
}

.divider-text {
    font-size: var(--text-base);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: var(--font-medium);
}

.browse-btn {
    color: var(--text-secondary);
    font-weight: var(--font-medium);
    text-decoration: underline;
    background: none;
    border: none;
    cursor: pointer;
    font-size: var(--text-lg);
    padding: 0;
}

.browse-btn:hover {
    color: var(--text-primary);
}

.file-types {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    margin-top: var(--space-4);
    font-family: var(--font-mono);
}

/* File Info Display */
.file-info {
    padding: var(--space-4);
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

.file-item {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.file-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-100);
    border-radius: var(--radius-lg);
    color: var(--primary-600);
}

.file-icon svg {
    width: 28px;
    height: 28px;
}

.file-details {
    flex: 1;
}

.file-name {
    font-size: var(--text-base);
    font-weight: var(--font-medium);
    color: var(--text-primary);
    margin-bottom: var(--space-1);
    word-break: break-all;
}

.file-size {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
}

.file-remove {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.file-remove:hover {
    background-color: var(--error-50);
    color: var(--error-500);
}

.file-remove svg {
    width: 20px;
    height: 20px;
}

/* Input Area Redesign */
.input-area {
    margin-bottom: var(--space-8);
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.input-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
}

.input-actions {
    display: flex;
    gap: var(--space-3);
}

.action-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid var(--border-color);
    background-color: var(--bg-primary);
    color: var(--text-secondary);
}

.action-btn:hover {
    background-color: var(--neutral-100);
    color: var(--text-primary);
    border-color: var(--neutral-300);
}

.action-btn.primary {
    background-color: var(--primary-50);
    color: var(--primary-600);
    border-color: var(--primary-200);
}

.action-btn.primary:hover {
    background-color: var(--primary-100);
    color: var(--primary-700);
}

.data-input {
    width: 100%;
    min-height: 200px;
    padding: var(--space-4);
    border: none;
    resize: vertical;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
}

.data-input:focus {
    outline: none;
    background-color: var(--bg-secondary);
}

.data-input::placeholder {
    color: var(--text-tertiary);
    opacity: 0.7;
}

/* ============================================
   CONVERTER SECTIONS
   ============================================ */
.converter-sections {
    display: grid;
    grid-template-columns: 350px minmax(0, 1fr);
    gap: var(--space-8);
    margin-top: var(--space-8);
}

/* Customization Panel */
.customization-panel {
    position: sticky;
    top: calc(var(--header-height) + var(--space-4));
    height: fit-content;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
}

.customization-panel h2 {
    font-size: var(--text-xl);
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--border-color);
}

.customization-panel h3 {
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    color: var(--text-secondary);
    margin-bottom: var(--space-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.settings-group {
    margin-bottom: var(--space-6);
}

.settings-group:last-child {
    margin-bottom: 0;
}

/* Preview & Output Section */
.preview-output-section {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.preview-header {
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.preview-header h3 {
    margin: 0;
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
}

.preview-info {
    padding: var(--space-3) var(--space-4);
    background-color: var(--info-50);
    border-left: 3px solid var(--info-500);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
}

.preview-info p {
    margin: 0;
    font-size: var(--text-sm);
    color: var(--info-700);
}

.preview-container {
    max-height: 600px;
    overflow: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    background-color: var(--bg-secondary);
    margin-bottom: var(--space-4);
    flex-grow: 1;
    /* Allow to expand */
}

/* Actions Area */
.code-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* Equal width buttons */
    gap: var(--space-4);
    gap: var(--space-4);
    /* margin-top: auto; Removed to close gap */
}

.code-actions .btn {
    justify-content: center;
    padding: var(--space-3);
}

/* Ensure empty state is well positioned */
/* Ensure empty state is well positioned */
.empty-state {
    padding: var(--space-8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    /* Reduced from 300px to respect compactness */
    text-align: center;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: var(--space-4);
    color: var(--text-tertiary);
    opacity: 0.5;
}

.empty-state p {
    font-size: var(--text-base);
    color: var(--text-secondary);
    max-width: 300px;
    margin: 0 auto;
}

#htmlCode {
    max-height: 600px;
    overflow: auto;
    font-size: var(--text-sm);
    line-height: 1.6;
}

/* ============================================
   SECTIONS
   ============================================ */
.how-to-use,
.features,
.faq,
.related-converters {
    padding: var(--space-16) 0;
}

.how-to-use {
    background-color: var(--bg-secondary);
}

.how-to-use h2,
.features h2,
.faq h2,
.related-converters h2 {
    text-align: center;
    margin-bottom: var(--space-12);
}

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-8);
}

.step {
    text-align: center;
    padding: var(--space-6);
    background-color: var(--bg-primary);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal);
}

.step:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.step-number {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-4);
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: white;
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    border-radius: var(--radius-full);
}

.step h3 {
    margin-bottom: var(--space-3);
}

.step p {
    font-size: var(--text-base);
    color: var(--text-secondary);
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-6);
}

.feature {
    padding: var(--space-6);
    text-align: center;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    transition: all var(--transition-normal);
}

.feature:hover {
    border-color: var(--primary-500);
    box-shadow: var(--shadow-md);
}

.feature svg {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--space-4);
    color: var(--primary-500);
}

.feature h3 {
    margin-bottom: var(--space-2);
}

/* FAQ */
.faq-list {
    max-width: 800px;
    margin: 0 auto;
}

.faq-item {
    margin-bottom: var(--space-4);
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.faq-item summary {
    padding: var(--space-4) var(--space-6);
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    cursor: pointer;
    user-select: none;
    transition: background-color var(--transition-fast);
    list-style: none;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary:hover {
    background-color: var(--neutral-50);
}

.faq-item p {
    padding: 0 var(--space-6) var(--space-4);
    color: var(--text-secondary);
}

/* Related Converters */
.converter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-4);
}

.converter-card {
    display: block;
    padding: var(--space-6);
    text-align: center;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-600));
    color: white;
    border-radius: var(--radius-lg);
    text-decoration: none;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
}

.converter-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.converter-card h3 {
    margin: 0;
    font-size: var(--text-lg);
    color: white;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1024px) {
    .converter-sections {
        grid-template-columns: 1fr;
    }

    .customization-panel {
        position: static;
        max-height: none;
    }
}

@media (max-width: 767px) {
    .page-header {
        padding: var(--space-8) 0 var(--space-6);
    }

    .page-header h1 {
        font-size: var(--text-2xl);
    }

    .format-icons img {
        width: 48px;
        height: 48px;
    }

    .dropzone {
        padding: var(--space-8) var(--space-4);
    }

    .converter-sections {
        gap: var(--space-6);
    }

    .code-actions {
        flex-direction: column;
    }

    .steps {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   TABLE GENERATOR SPECIFIC STYLES
   ============================================ */

.tg-toolbar .btn-group {
    display: flex;
    gap: 2px;
}

.tg-toolbar .icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tg-toolbar .icon-btn:hover {
    background: var(--bg-secondary);
    color: var(--primary-600);
}

.tg-sidebar .grid-selector {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
}

.editable-cell {
    min-width: 100%;
    min-height: 100%;
    cursor: text;
}

.editable-cell:focus {
    background-color: var(--bg-primary);
    box-shadow: inset 0 0 0 2px var(--primary-500);
}

/* Dropdown Animation */
.dropdown-menu {
    transform-origin: top left;
    animation: scaleIn 0.1s ease-out;
}

@keyframes scaleIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@media (max-width: 1024px) {
    .tg-layout {
        grid-template-columns: 1fr !important;
    }

    .tg-sidebar {
        order: -1;
    }
}

/* ============================================
   Chic Tool Header (Phase 5)
   ============================================ */
.tool-header-center {
    text-align: center;
    padding: 6rem 1rem 3rem 1rem;
    background: var(--bg-primary);
    margin-bottom: 3rem;
    border-bottom: 1px solid var(--border-color);
}

.tool-header-center h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 1rem;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--primary-600), var(--primary-800));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="dark"] .tool-header-center h1 {
    background: linear-gradient(135deg, var(--primary-400), var(--primary-200));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="dark"] .tool-header-center {
    background-image: none;
}

.tool-header-center p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Delete Buttons Fix */
/* ============================================
   Phase 3 Refinements
   ============================================ */

/* Delete Buttons - Chic UI */
.del-col-btn,
.del-row-btn {
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    border-radius: 50%;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    cursor: pointer;
    font-size: 14px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100 !important;
    padding: 0 !important;
    width: 24px !important;
    height: 24px !important;
}

.del-col-btn:hover,
.del-row-btn:hover {
    background: #ef4444;
    /* Red-500 */
    color: white;
    border-color: #ef4444;
    /* Scale transform handled in specific rules */
}

/* Hover Logic - Only show on hover */
th:hover .del-col-btn {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-2px) !important;
}

tr:hover .del-row-btn {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) scale(1.1) !important;
}

/* Positioning */
/* Positioning */
.del-col-btn {
    position: absolute;
    top: 2px !important;
    right: 2px !important;
    left: auto !important;
    transform: none !important;
    transition: all 0.2s ease;
}

.del-col-btn:hover {
    transform: scale(1.1) !important;
}

.del-row-btn {
    position: absolute;
    left: 10px !important;
    top: 50% !important;
    right: auto !important;
    transform: translateY(-50%) !important;
    transition: transform 0.2s, opacity 0.2s, visibility 0.2s;
}

/* Fix Grid Layout Overflow */
.tg-main {
    min-width: 0;
}

.del-row-btn:hover {
    transform: translate(-50%, -50%) scale(1.1) !important;
}

/* Manual Input Styling */
.manual-input-container {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    margin-top: 1rem;
}

.manual-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-secondary);
    padding: 0.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.manual-input {
    width: 100%;
    padding: 6px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
}

.manual-input:focus {
    outline: none;
}

.manual-divider {
    color: var(--text-tertiary);
    font-size: 0.8rem;
    user-select: none;
}

.btn-manual-go {
    background: var(--primary-500);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 4px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-manual-go:hover {
    background: var(--primary-600);
}

/* Row Numbers */
.row-number-cell {
    background: var(--bg-tertiary) !important;
    color: var(--text-tertiary);
    font-size: 11px;
    text-align: center;
    user-select: none;
    border: none !important;
    width: 40px;
    min-width: 40px;
}

/* Centered Header */
.tool-header-center {
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
}

.tool-header-center h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.tool-header-center p {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* Chic Header & Tabs (Phase 8) */
.chic-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 var(--space-4);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    min-height: 52px;
}

.chic-tabs {
    display: flex;
    gap: var(--space-2);
    height: 100%;
}

.chic-tab {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0 var(--space-4);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    height: 52px;
}

.chic-tab:hover {
    color: var(--text-primary);
    background-color: var(--bg-secondary);
}

.chic-tab.active {
    color: var(--primary-600);
    border-bottom-color: var(--primary-600);
    background-color: var(--primary-50);
}

.chic-tab svg {
    display: none;
}

/* Update Input Area to work with Chic Header */
.input-area {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.data-input {
    border: none;
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
    padding: var(--space-4);
    min-height: 300px;
    resize: vertical;
    width: 100%;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: 1.6;
    background: transparent;
    color: var(--text-primary);
}

.data-input:focus {
    box-shadow: none;
    outline: none;
}

/* Hide Browse Button in Action Bar since it's now a tab */
.input-actions .browse-btn {
    display: none;
}

.input-actions .action-btn svg {
    display: none;
}

/* Dark Mode Adjustments */
[data-theme="dark"] .chic-header {
    background: var(--bg-secondary);
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .chic-tab:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .chic-tab.active {
    background-color: rgba(14, 165, 233, 0.1);
}

[data-theme="dark"] .input-area {
    background: var(--bg-secondary);
}

/* ============================================
   CRON JOB GENERATOR DARK MODE FIX
   ============================================ */
.preset-btn {
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.preset-btn:hover {
    background: var(--primary-50) !important;
    border-color: var(--primary-400) !important;
    color: var(--primary-600) !important;
}

[data-theme="dark"] .preset-btn {
    background: #334155 !important;
    /* Slate-700 - visible in dark */
    border-color: #475569 !important;
    /* Slate-600 */
    color: #e2e8f0 !important;
    /* Light text */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .preset-btn:hover {
    background: #475569 !important;
    border-color: var(--primary-400) !important;
    color: var(--primary-300) !important;
    box-shadow: 0 2px 6px rgba(14, 165, 233, 0.2);
}

/* Cron Grid Items */
[data-theme="dark"] .grid-item {
    background: #334155 !important;
    border-color: #475569 !important;
    color: #e2e8f0;
}

[data-theme="dark"] .grid-item:hover {
    background: #475569 !important;
    border-color: var(--primary-400) !important;
}

[data-theme="dark"] .cron-config-panel {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    padding: 1rem;
}

[data-theme="dark"] .selection-grid {
    background: rgba(51, 65, 85, 0.5);
    padding: 0.5rem;
    border-radius: var(--radius-md);
}