@import url('../shared/base.css');

.app-container {
    max-width: 960px;
}

.app-main {
    padding: 1rem;
    flex: 1;
}

.tabs-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 0.35rem;
    border: 1px solid var(--border);
}

.tab-btn {
    flex: 1;
    padding: 0.7rem 1rem;
    border: none;
    border-radius: calc(var(--radius-sm) - 3px);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
    transition: all 0.2s;
    text-align: center;
}

.tab-btn:hover {
    background: var(--bg);
    color: var(--text);
}

.tab-btn.active {
    background: var(--accent);
    color: #fff;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.selector-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

@media (min-width: 600px) {
    .selector-row {
        grid-template-columns: 1fr 1fr 1fr;
    }
}

.input-group {
    margin-bottom: 0.75rem;
}

.input-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 0.7rem 0.85rem;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
    color: var(--text);
    font-size: 0.95rem;
    font-family: var(--font);
    transition: border-color 0.2s;
    -webkit-appearance: none;
}

.input-group input:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.table-container {
    overflow-x: auto;
    margin-top: 0.5rem;
}

#tolerance-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

#tolerance-table th {
    background: var(--accent);
    color: #fff;
    padding: 0.65rem 0.75rem;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
}

#tolerance-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

#tolerance-table tbody tr {
    transition: background 0.2s;
}

#tolerance-table tbody tr:hover {
    background: var(--accent-light);
}

#tolerance-table tbody tr.active-row {
    background: rgba(59, 130, 246, 0.12);
    font-weight: 700;
    border-left: 3px solid var(--accent);
}

body.dark-theme #tolerance-table tbody tr.active-row {
    background: rgba(59, 130, 246, 0.2);
}

.reference-note {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-style: italic;
}

.input-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

@media (min-width: 600px) {
    .input-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.btn-row {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.btn-primary {
    flex: 1;
    padding: 0.85rem;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: white;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font);
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary:hover { opacity: 0.85; }

.btn-outline {
    padding: 0.85rem 1.2rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.btn-outline:hover { background: var(--bg); }

#result-card { min-height: 200px; }

.result-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 2rem;
    color: var(--text-secondary);
    text-align: center;
}

.result-placeholder i { font-size: 2.5rem; opacity: 0.3; }

.result-placeholder p { font-size: 0.9rem; margin: 0; }

.shim-results {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.shim-card {
    padding: 1.25rem;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border);
    text-align: center;
    transition: all 0.2s;
}

.shim-card h3 {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.75rem;
}

.shim-value {
    font-size: 1.8rem;
    font-weight: 800;
    font-family: monospace;
    margin-bottom: 0.35rem;
}

.shim-front .shim-value { color: var(--accent); }
.shim-rear .shim-value { color: #f97316; }

.shim-action {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    display: inline-block;
}

.shim-action.add { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.shim-action.remove { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.shim-action.none { background: rgba(100, 116, 139, 0.15); color: var(--text-secondary); }

body.dark-theme .shim-action.add { background: rgba(34, 197, 94, 0.25); }
body.dark-theme .shim-action.remove { background: rgba(239, 68, 68, 0.25); }

.history-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem 0;
}

.history-list li {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.83rem;
    transition: background 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.history-list li:hover { background: var(--bg); }
.history-list li:last-child { border-bottom: none; }

.history-placeholder {
    color: var(--text-secondary);
    text-align: center;
    padding: 1.5rem !important;
    font-style: italic;
}

.history-label { font-weight: 500; white-space: nowrap; }
.history-value { font-family: monospace; font-weight: 600; font-size: 0.78rem; }

@media (max-width: 480px) {
    .shim-results {
        grid-template-columns: 1fr;
    }
    .btn-row {
        flex-direction: column;
    }
}

/* ===== New styles for Face-Rim and Laser tabs ===== */

.section-divider {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin: 1rem 0 0.75rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border);
}

.canvas-container {
    display: flex;
    justify-content: center;
    margin: 0.5rem 0;
    overflow-x: auto;
}

.canvas-container canvas {
    max-width: 100%;
    height: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg);
}

.suggested-shims {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 2px dashed var(--border);
}

.suggested-shims h3 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 0.75rem;
}

.shim-combo-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.shim-combo-section strong {
    display: block;
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
}

.shim-item {
    font-family: monospace;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    padding: 0.4rem 0.6rem;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    min-height: 2rem;
}

.result-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.result-grid-4 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.result-value {
    font-size: 1.5rem;
    font-weight: 800;
    font-family: monospace;
    margin: 0.25rem 0;
}

.result-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    display: block;
    margin-bottom: 0.15rem;
}

@media (max-width: 600px) {
    .result-grid-2,
    .result-grid-4 {
        grid-template-columns: 1fr;
    }
    .shim-combo-section {
        grid-template-columns: 1fr;
    }
}

.laser-diagram {
    text-align: center;
    margin: 1rem 0;
}

.laser-diagram svg {
    max-width: 100%;
}
