/* ===================================================================
   Settings Page Styles - Professional Design
   =================================================================== */

/* Settings Container */
.settings-container {
    max-width: var(--max-content-width);
    margin: 0 auto;
    padding: var(--space-8);
    background: var(--bg-primary);
    min-height: calc(100vh - var(--header-height));
}

.settings-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-8);
}

.settings-title {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    color: var(--text-primary);
    font-size: var(--font-size-3xl);
    font-weight: var(--font-weight-bold);
    margin: 0 0 var(--space-8) 0;
    text-shadow: none;
}

.settings-icon {
    width: 2.5rem;
    height: 2.5rem;
    color: var(--color-primary-500);
}

/* Professional Cards */
.settings-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-xl);
    padding: var(--space-8);
    box-shadow: var(--shadow-lg);
    position: relative;
    transition: all var(--transition-normal);
}

.settings-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--color-primary-500), var(--color-primary-600));
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.settings-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
    border-color: var(--border-secondary);
}

.settings-card-title {
    color: var(--text-primary);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    margin: 0 0 var(--space-3) 0;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.settings-card-title::before {
    content: '';
    width: 6px;
    height: 24px;
    background: linear-gradient(135deg, var(--color-primary-500), var(--color-primary-600));
    border-radius: 3px;
}

.settings-card-description {
    color: var(--text-secondary);
    font-size: var(--font-size-base);
    margin: 0 0 var(--space-8) 0;
    line-height: var(--line-height-relaxed);
}

/* Enhanced Preset Controls */
.preset-controls {
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
}

.control-group {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    transition: all var(--transition-fast);
}

.control-group:hover {
    border-color: var(--border-secondary);
    background: var(--bg-surface-hover);
}

.control-label {
    color: var(--text-primary);
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-base);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.control-label::before {
    content: '';
    width: 4px;
    height: 4px;
    background: var(--color-primary-500);
    border-radius: 50%;
}

.preset-selector {
    display: flex;
    gap: var(--space-4);
    align-items: stretch;
}

:is(.settings-select, .preset-dropdown, .calibration-dropdown, .reference-dropdown) {
    flex: 1;
    min-width: 220px;
    padding: var(--space-3) var(--space-4);
    padding-right: var(--space-10);
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' stroke-width='1.5' stroke='%2394a3b8' fill='none' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right var(--space-4) center;
    background-size: 14px 14px;
}

:is(.settings-select, .preset-dropdown, .calibration-dropdown, .reference-dropdown):focus {
    outline: none;
    border-color: var(--color-primary-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    background: var(--bg-surface);
}

:is(.settings-select, .preset-dropdown, .calibration-dropdown, .reference-dropdown):hover:not(:disabled) {
    border-color: var(--color-primary-500);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

:is(.settings-select, .preset-dropdown, .calibration-dropdown, .reference-dropdown):disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.preset-info {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
}

.preset-details {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
}

.preset-param {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.param-label {
    color: var(--text-secondary);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
}

.param-value {
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    font-family: var(--font-mono);
}

/* Calibration Status */
.calibration-status {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-6);
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-2) 0;
}

.status-label {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
}

.status-value {
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    font-family: var(--font-mono);
}

/* Calibration Workflow */
.calibration-workflow {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.workflow-section {
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    background: var(--bg-surface);
    transition: all var(--transition-fast);
}

.workflow-section:hover {
    border-color: var(--border-secondary);
}

.workflow-title {
    color: var(--text-primary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    margin: 0 0 var(--space-4) 0;
}

.workflow-controls {
    display: flex;
    gap: var(--space-3);
    align-items: center;
}

/* Calibration Progress */
.calibration-progress {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
}

.progress-info {
    text-align: center;
}

.progress-text {
    color: var(--text-primary);
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    font-family: var(--font-mono);
}

/* Calibration Standards */
.calibration-standards {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.calibration-standard-btn {
    min-width: 120px;
    white-space: nowrap;
}

.calibration-standard-btn .icon {
    margin-right: var(--space-2);
}

.calibration-standard-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Calibration Actions */
:is(.settings-action-group, .calibration-actions, .reference-actions) {
    display: flex;
    gap: var(--space-3);
    align-items: stretch;
    flex-wrap: wrap;
}

.calibration-actions {
    margin-top: var(--space-4);
}

:is(.settings-input, .calibration-name-input, .reference-name-input, .reference-description-input) {
    flex: 1;
    padding: var(--space-3) var(--space-4);
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    min-height: 2.75rem;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

:is(.settings-input, .calibration-name-input, .reference-name-input, .reference-description-input):focus {
    outline: none;
    border-color: var(--color-primary-500);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

:is(.settings-input, .calibration-name-input, .reference-name-input, .reference-description-input):disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

:is(.settings-input, .calibration-name-input, .reference-name-input, .reference-description-input)::placeholder {
    color: var(--text-tertiary);
}

/* Existing Calibrations */
.existing-calibrations,
.existing-references {
    display: flex;
    gap: var(--space-3);
    align-items: stretch;
    flex-wrap: wrap;
}

/* Status Grid */
.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
}

.status-grid .status-item {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
    transition: all var(--transition-fast);
}

.status-grid .status-item:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-secondary);
}

.status-grid .status-label {
    font-size: var(--font-size-xs);
    margin: 0;
}

.status-grid .status-value {
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .settings-container {
        padding: var(--spacing-md);
    }

    .preset-selector {
        flex-direction: column;
    }

    .calibration-actions {
        flex-direction: column;
    }

    .existing-calibrations,
    .existing-references {
        flex-direction: column;
    }

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

    .calibration-standards {
        flex-direction: column;
    }

    .calibration-standard-btn {
        min-width: auto;
    }
}

/* Animation and Transitions */
.settings-card {
    transition: box-shadow 0.2s ease;
}

.settings-card:hover {
    box-shadow: var(--shadow-md);
}

.workflow-section {
    transition: border-color 0.2s ease;
}

.workflow-section:hover {
    border-color: var(--color-primary-alpha);
}

/* Loading States */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Success/Error States */
.preset-param .param-value.success {
    color: var(--color-success-500);
}

.preset-param .param-value.error {
    color: var(--color-error-500);
}

.preset-param .param-value.warning {
    color: var(--color-warning-500);
}

/* Calibration standard button states */
.calibration-standard-btn.btn--success {
    background-color: var(--color-success-500);
    border-color: var(--color-success-500);
    color: white;
}

.calibration-standard-btn.btn--success:hover:not(:disabled) {
    background-color: var(--color-success-600);
    border-color: var(--color-success-600);
}

.calibration-standard-btn.btn--warning {
    background-color: var(--color-warning-500);
    border-color: var(--color-warning-500);
    color: white;
}

.calibration-standard-btn.btn--warning:hover:not(:disabled) {
    background-color: var(--color-warning-600);
    border-color: var(--color-warning-600);
}

/* ========================================
   Reference Management Styles
   ======================================== */

/* Reference Creation */
.reference-creation {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.reference-actions {
    margin-top: var(--space-3);
}

#currentReferenceInfo {
    display: none;
    flex-direction: column;
}

/* Reference details */
.reference-details {
    margin-top: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-primary);
    background: var(--bg-surface);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.reference-details__row {
    display: flex;
    gap: var(--space-2);
    font-size: var(--font-size-sm);
    align-items: baseline;
}

.reference-details__label {
    min-width: 90px;
    color: var(--text-secondary);
    font-weight: var(--font-weight-medium);
}

.reference-details__value {
    color: var(--text-primary);
    flex: 1 1 auto;
    word-break: break-word;
}

.reference-details__row--description {
    align-items: flex-start;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .reference-creation {
        gap: var(--space-2);
    }

    .reference-actions {
        flex-direction: column;
        gap: var(--space-2);
    }

    .reference-dropdown {
        min-width: unset;
    }
}

/* ========================================
   Laser Parameters Table Styles
   ======================================== */

.laser-params-table {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-3);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
}

.laser-param-cell {
    display: flex;
    align-items: center;
    justify-content: center;
}

.laser-param-header {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    text-align: center;
    padding: var(--space-3);
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-primary);
}

.laser-param-input {
    display: flex;
    align-items: stretch;
}

.laser-param-input .settings-input {
    width: 100%;
    text-align: center;
    font-family: var(--font-mono);
    font-weight: var(--font-weight-medium);
}

/* Responsive layout for smaller screens */
@media (max-width: 1024px) {
    .laser-params-table {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .laser-params-table {
        grid-template-columns: 1fr;
    }

    .laser-param-header {
        text-align: left;
    }

    .laser-param-input .settings-input {
        text-align: left;
    }
}
