:root {
    --bg-dark: #0a0b0d;
    --bg-card: #14161a;
    --accent: #007aff;
    --accent-glow: rgba(0, 122, 255, 0.4);
    --text-main: #e0e0e0;
    --text-dim: #949494;
    --border: #22252a;
    --success: #34c759;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background-color: var(--bg-card);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.logo-area {
    padding: 30px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #007aff, #00c6ff);
    border-radius: 8px;
    box-shadow: 0 0 15px var(--accent-glow);
}

.logo-area h1 {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.history-panel {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px 20px;
}

.section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 20px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    background: #1c1f24;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.history-item:hover {
    border-color: var(--accent);
    background: #23272d;
}

.history-item .ts {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-bottom: 4px;
}

.history-item .file-name {
    font-size: 0.85rem;
    font-weight: 500;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 40px;
    overflow-y: auto;
    background: radial-gradient(circle at top right, #111418, transparent);
}

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

header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.status-badge {
    font-size: 0.75rem;
    background: rgba(52, 199, 89, 0.1);
    color: var(--success);
    padding: 6px 12px;
    border-radius: 20px;
    border: 1px solid rgba(52, 199, 89, 0.2);
}

.calibration-hero {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 25px;
    margin-bottom: 30px;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 25px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.upload-card {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 250px;
    border: 2px dashed var(--border);
    background: rgba(20, 22, 26, 0.5);
}

.upload-card.dragover {
    border-color: var(--accent);
    background: rgba(0, 122, 255, 0.05);
}

.upload-content {
    text-align: center;
}

.upload-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 15px;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="%233498db"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"/></svg>') no-repeat center;
}

.upload-content p {
    color: var(--text-dim);
    margin-bottom: 20px;
}

.btn {
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: 0.2s;
}

.btn-primary {
    background-color: var(--accent);
    color: white;
}

.btn-primary:hover {
    background-color: #0066d6;
}

.btn-glow {
    width: 100%;
    margin-top: 10px;
    background: linear-gradient(135deg, #007aff, #00c6ff);
    color: white;
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-glow:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--accent-glow);
}

.form-group {
    margin-top: 20px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 8px;
}

.radio-group {
    display: flex;
    gap: 15px;
}

.radio-label {
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

input[type="number"] {
    width: 100%;
    background: #1c1f24;
    border: 1px solid var(--border);
    color: white;
    padding: 10px;
    border-radius: 6px;
}

/* Results section */
.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 25px;
}

.result-card .label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.5px;
}

.value-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.main-value {
    font-size: 2rem;
    font-weight: 700;
    font-family: monospace;
}

.copy-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
}

.copy-btn:hover {
    color: white;
    border-color: var(--text-dim);
}

.visual-verification .debug-img-container {
    width: 100%;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    margin-top: 15px;
    min-height: 800px;
}

#debug-img {
    width: 100%;
    display: block;
}

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--accent);
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 600;
    transition: transform 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

/* branding */
.header-right .brand-logo {
    height: 48px;
    filter: drop-shadow(0 0 10px rgba(0, 122, 255, 0.2));
}

.badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
}

.badge.success {
    background: rgba(52, 199, 89, 0.2);
    color: var(--success);
}

/* History Item adjustments */
.history-item {
    position: relative;
    padding-right: 40px;
}

.delete-action {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.3;
    transition: opacity 0.2s, color 0.2s;
    cursor: pointer;
}

.history-item:hover .delete-action {
    opacity: 0.8;
}

.delete-action:hover {
    color: #ff3b30;
    opacity: 1 !important;
}

.trash-icon {
    width: 18px;
    height: 18px;
    display: inline-block;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/></svg>') no-repeat center;
}
