/* Typography Scale - App-Specific Styles. Base styles provided by shared-app.css */

/* App-specific CSS custom properties */
:root {
    --selected-font: 'Inter', sans-serif;
    --accent-orange: #ff6b35; /* Added for tutorial button */
    --accent-orange-hover: #e55a2b; /* Added for tutorial button */
}

/* ==== MODAL STYLES (NEW) ==== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    backdrop-filter: blur(4px);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    width: 90vw;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    box-shadow: var(--shadow-strong);
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

.modal-header {
    background: var(--bg-secondary);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.modal-title {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 0;
}

.video-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Tutorial button styles (NEW) */
.tutorial-btn {
    background: var(--accent-orange);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-right: 12px;
}

.tutorial-btn:hover {
    background: var(--accent-orange-hover);
    transform: translateY(-1px);
}

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

/* Mobile responsiveness for modal */
@media (max-width: 768px) {
    .modal-container {
        width: 95vw;
        max-height: 85vh;
    }

    .modal-header {
        padding: 16px;
    }

    .modal-title {
        font-size: 16px;
    }
}
/* ==== END MODAL STYLES ==== */

/* Form select (not in shared - shared only provides .form-input) */
.form-select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.2s;
}

.form-select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

/* Override shared .input-hint (different margin-top, no font-style) */
.input-hint {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.usage-tips {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.usage-tip {
    display: flex;
    align-items: center;
    font-size: 14px;
    color: var(--text-primary);
    line-height: 1.4;
    padding: 8px 0;
}

/* Breakpoint sections */
.breakpoint-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
    position: relative;
}

.breakpoint-section:last-child {
    margin-bottom: 0;
}

/* Scroll indicator */
.breakpoint-section::after {
    content: '\2190 Scroll horizontally to see all columns \2192';
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: var(--accent-color);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 5;
}

.breakpoint-section.show-scroll-hint::after {
    opacity: 0.8;
}

.breakpoint-header {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.breakpoint-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.scale-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.scale-controls label {
    font-size: 13px;
    margin: 0;
    color: var(--text-primary);
}

.scale-controls select,
.scale-controls input {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 13px;
    min-width: 140px;
}

.scale-controls input {
    min-width: 80px;
}

.scale-reset-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    opacity: 0.8;
    transition: all 0.2s;
}

.scale-reset-btn:hover {
    opacity: 1;
    transform: translateY(-1px);
}

/* Typography Table */
.table-container {
    padding: 0;
    overflow-x: auto;
    overflow-y: visible;
    /* Add scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) var(--bg-secondary);
}

.table-container::-webkit-scrollbar {
    height: 8px;
}

.table-container::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: var(--accent-hover);
}

.typography-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px; /* Ensure minimum width for large font samples */
}

.typography-table th {
    background: var(--bg-secondary);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-primary);
    font-size: 13px;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 10;
}

.typography-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
    color: var(--text-primary);
    white-space: nowrap; /* Prevent text wrapping */
}

.typography-table tr:hover {
    background: var(--bg-secondary);
}

.type-sample {
    font-family: var(--selected-font);
    margin: 0;
    line-height: 1.2;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
    min-width: 200px; /* Ensure adequate space for large text */
    display: inline-block;
    max-width: 400px; /* Cap maximum width */
    overflow: hidden;
    text-overflow: ellipsis;
}

.type-sample:hover {
    background: rgba(13, 110, 253, 0.1);
}

.type-sample.editing {
    background: transparent;
    padding: 0;
}

.name-input {
    width: 100%;
    border: 2px solid var(--accent-color);
    padding: 4px;
    font-size: inherit;
    font-weight: inherit;
    font-family: inherit;
    background: white;
    border-radius: 4px;
    color: var(--bg-primary);
}

.editable {
    cursor: pointer;
    position: relative;
    transition: all 0.2s;
}

.editable:hover {
    background: rgba(13, 110, 253, 0.1);
}

.editable.editing {
    padding: 0;
}

.edit-input {
    width: 100%;
    border: 2px solid var(--accent-color);
    padding: 8px;
    font-size: 14px;
    text-align: center;
    background: white;
    color: var(--bg-primary);
    border-radius: 4px;
}

.override-indicator {
    color: var(--accent-color);
    font-weight: 600;
}

.reset-btn {
    font-size: 10px;
    color: #6c757d;
    cursor: pointer;
    margin-left: 4px;
    opacity: 0.7;
    transition: all 0.2s;
}

.reset-btn:hover {
    color: #dc3545;
    opacity: 1;
}

.classes-header {
    background: #33383e !important;
    color: white;
    padding: 8px 16px !important;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.5px;
}

/* Export Section */
.export-section {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
}

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

.export-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.export-actions {
    display: flex;
    gap: 12px;
}

.btn-copy {
    background: var(--accent-success);
    color: white;
    border-color: var(--accent-success);
}

.btn-copy:hover {
    background: #5aa65a;
    border-color: #5aa65a;
}

.css-output {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    white-space: pre-wrap;
    height: 120px;
    overflow-y: auto;
    color: var(--text-primary);
    line-height: 1.4;
    resize: none;
    width: 100%;
    box-sizing: border-box;
    transition: height 0.3s ease;
}

.css-output.has-content {
    height: 600px !important;
}

/* Light mode preview for tables */
.breakpoint-section.light-mode {
    background: #ffffff;
    border-color: #e6e6e6;
}

.breakpoint-section.light-mode .breakpoint-header {
    background: #f8f9fa;
    color: #343a40;
    border-bottom-color: #e6e6e6;
}

.breakpoint-section.light-mode .scale-controls label {
    color: #343a40;
}

.breakpoint-section.light-mode .scale-controls select,
.breakpoint-section.light-mode .scale-controls input {
    background: #ffffff;
    color: #343a40;
    border-color: #e6e6e6;
}

.breakpoint-section.light-mode .typography-table th {
    background: #f8f9fa;
    color: #343a40;
    border-bottom-color: #e6e6e6;
}

.breakpoint-section.light-mode .typography-table td {
    border-bottom-color: #e6e6e6;
    color: #343a40;
}

.breakpoint-section.light-mode .typography-table tr:hover {
    background: #f8f9fa;
}

.breakpoint-section.light-mode .type-sample {
    color: #343a40;
}

.breakpoint-section.light-mode .editable:hover {
    background: rgba(13, 110, 253, 0.1);
}

.breakpoint-section.light-mode .override-indicator {
    color: var(--accent-color);
}

.breakpoint-section.light-mode .classes-header {
    background: #d2d7db !important;
    color: white;
}

/* Checkbox using accent-color approach (differs from shared custom checkbox) */
.form-check-input {
    accent-color: var(--accent-color);
}

.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

/* Responsive: tablet */
@media (max-width: 1024px) {
    .scale-controls {
        flex-wrap: wrap;
        gap: 4px;
    }

    .scale-controls select,
    .scale-controls input {
        min-width: 100px;
    }
}

/* Responsive: mobile */
@media (max-width: 768px) {
    .breakpoint-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .scale-controls {
        justify-content: center;
    }

    .export-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .export-actions {
        justify-content: stretch;
    }

    .btn {
        flex: 1;
        text-align: center;
    }

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

    .type-sample {
        min-width: 120px;
    }
}
