/* =====================================================
   Components Styles
   ===================================================== */

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
}

.modal.hidden {
    display: none;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow: auto;
}

.modal-sm {
    max-width: 360px;
}

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

.modal-title {
    font-size: var(--scale-h4);
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.modal-close:hover {
    color: var(--text);
}

.modal-body {
    padding: var(--space-lg);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    padding: var(--space-lg);
    border-top: 1px solid var(--border);
}

/* Progress Bar */
.export-progress {
    text-align: center;
}

.progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: var(--space-md);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border-radius: var(--radius-full);
    width: 0%;
    transition: width var(--transition-base);
}

.progress-text {
    color: var(--text-secondary);
    font-size: var(--scale-small);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: var(--space-xl);
    right: var(--space-xl);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-lg);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: var(--scale-small);
    animation: slideIn 0.3s ease;
    max-width: 360px;
}

.toast-success {
    border-left: 4px solid var(--success);
}

.toast-error {
    border-left: 4px solid var(--danger);
}

.toast-warning {
    border-left: 4px solid var(--warning);
}

.toast-info {
    border-left: 4px solid var(--accent);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Radio Labels */
.radio-label {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.radio-label:hover {
    background: var(--accent-light);
    border-color: var(--accent);
}

.radio-label input:checked+span {
    color: var(--accent);
    font-weight: 600;
}

/* Scale Table */
.scale-tables {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xl);
}

@media (max-width: 1024px) {
    .scale-tables {
        grid-template-columns: 1fr;
    }
}

.table-container {
    overflow-x: auto;
}

.table-title {
    font-size: var(--scale-h4);
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--text);
}

.scale-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--scale-small);
}

.scale-table th,
.scale-table td {
    padding: var(--space-sm) var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.scale-table th {
    font-weight: 600;
    background: var(--bg);
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: var(--scale-xs);
    letter-spacing: 0.5px;
}

.scale-table tbody tr:hover {
    background: var(--accent-light);
}

/* Code Block */
.code-block {
    position: relative;
    background: #1e293b;
    border-radius: var(--radius-md);
    padding: var(--space-lg);
    overflow-x: auto;
}

.code-block pre {
    margin: 0;
    font-family: 'Fira Code', 'Monaco', monospace;
    font-size: var(--scale-small);
    line-height: 1.6;
    color: #e2e8f0;
}

.code-block code {
    font-family: inherit;
}

.copy-btn {
    position: absolute;
    top: var(--space-sm);
    right: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-size: var(--scale-xs);
    cursor: pointer;
    transition: background var(--transition-fast);
}

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

/* Loading Spinner */
.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Tooltip */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: var(--space-xs) var(--space-sm);
    background: var(--text);
    color: var(--bg);
    font-size: var(--scale-xs);
    border-radius: var(--radius-sm);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    z-index: 100;
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: 600;
    border-radius: var(--radius-full);
    background: var(--accent-light);
    color: var(--accent);
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}