/* ===== ITH Medical - Dictaphone Pro ===== */

:root {
    --rec-red: #dc2626;
    --rec-amber: #d97706;
    --rec-green: #16a34a;
}

.dict-pro {
    background: #f1f5f9;
    min-height: calc(100vh - 80px);
    padding: 30px 0 60px;
}

.dict-shell {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
}

@media (max-width: 1024px) {
    .dict-shell { grid-template-columns: 1fr; }
}

.card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    overflow: hidden;
}

.card-header {
    padding: 14px 18px;
    border-bottom: 1px solid #f1f5f9;
    background: #fafbfc;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #475569;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-body { padding: 16px 18px; }

.sidebar { display: flex; flex-direction: column; gap: 16px; }

.btn-new {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
    transition: all 0.15s;
}
.btn-new:hover { background: var(--primary-dark); transform: translateY(-1px); }

.session-list {
    list-style: none;
    margin: 0;
    padding: 8px;
    max-height: 380px;
    overflow-y: auto;
}

.session-item {
    padding: 12px;
    margin-bottom: 4px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
    position: relative;
}

.session-item:hover { background: #f8fafc; }
.session-item.active { background: #ecfeff; border-color: #a5f3fc; }

.session-item .name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 24px;
}

.session-item .meta {
    font-size: 0.74rem;
    color: #64748b;
    display: flex;
    gap: 10px;
}

.session-item .meta .duration {
    color: var(--primary);
    font-weight: 600;
    font-family: 'SF Mono', monospace;
}

.session-delete {
    position: absolute;
    top: 10px;
    right: 8px;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0;
    transition: all 0.15s;
}

.session-item:hover .session-delete { opacity: 1; }
.session-delete:hover { background: #fee2e2; color: var(--rec-red); }

.empty-list {
    text-align: center;
    color: #94a3b8;
    font-size: 0.85rem;
    padding: 30px 16px;
}

.device {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 12px;
}

.device.connected { background: #ecfdf5; border-color: #a7f3d0; }

.device-icon {
    width: 38px; height: 38px;
    border-radius: 9px;
    background: #94a3b8;
    color: white;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.device.connected .device-icon { background: var(--rec-green); }

.device-info { flex: 1; min-width: 0; }
.device-name { font-weight: 700; color: var(--dark); font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.device-state { font-size: 0.74rem; color: #64748b; }

.btn-secondary {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid var(--primary);
    background: white;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.85rem;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    transition: all 0.15s;
}
.btn-secondary:hover { background: var(--primary); color: white; }
.btn-secondary + .btn-secondary { margin-top: 8px; }

.btn-map { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; padding: 8px 0; font-size: 0.83rem; border-bottom: 1px solid #f1f5f9; }
.btn-map:last-child { border-bottom: none; }
.btn-map .name { color: #475569; font-weight: 500; }
.btn-map .key {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 4px 10px;
    font-family: 'SF Mono', monospace;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--dark);
    transition: all 0.15s;
}
.btn-map .key.active { background: var(--secondary); border-color: var(--secondary-dark); transform: scale(1.1); }

.main { display: flex; flex-direction: column; gap: 16px; }

.session-bar {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.session-name-input {
    flex: 1;
    border: none;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--dark);
    background: transparent;
    outline: none;
    padding: 6px 10px;
    border-radius: 6px;
    font-family: inherit;
    min-width: 0;
}
.session-name-input:hover, .session-name-input:focus { background: #f1f5f9; }

.session-bar .meta-info {
    font-size: 0.78rem;
    color: #64748b;
    font-family: 'SF Mono', monospace;
    white-space: nowrap;
}

.transport {
    background: linear-gradient(160deg, #1e293b 0%, #0f172a 100%);
    border-radius: 14px;
    padding: 24px;
    color: white;
    box-shadow: 0 10px 30px rgba(15,23,42,0.3);
}

.transport-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}

.transport-time {
    font-family: 'SF Mono', 'Cascadia Mono', Monaco, monospace;
    font-size: 2rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: white;
}

.transport-time .total {
    font-size: 1rem;
    color: rgba(255,255,255,0.4);
    margin-left: 8px;
}

.transport-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255,255,255,0.08);
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.transport-status .dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #64748b;
}

.transport-status.recording { background: rgba(220,38,38,0.2); color: #fca5a5; }
.transport-status.recording .dot { background: var(--rec-red); animation: rec-pulse 1.2s ease-in-out infinite; }
.transport-status.playing { background: rgba(22,163,74,0.2); color: #86efac; }
.transport-status.playing .dot { background: var(--rec-green); animation: rec-pulse 1.5s ease-in-out infinite; }
.transport-status.paused { background: rgba(217,119,6,0.2); color: #fcd34d; }
.transport-status.paused .dot { background: var(--rec-amber); }

@keyframes rec-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.4); }
}

.waveform-container {
    height: 100px;
    background: rgba(0,0,0,0.35);
    border-radius: 10px;
    margin-bottom: 18px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.waveform-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

.waveform-cursor {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--secondary);
    box-shadow: 0 0 10px var(--secondary);
    pointer-events: none;
    left: 0;
}

.waveform-marker {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: #f59e0b;
    pointer-events: none;
}
.waveform-marker::before {
    content: '';
    position: absolute;
    top: 0;
    left: -5px;
    width: 12px;
    height: 8px;
    background: #f59e0b;
    border-radius: 2px;
}

.waveform-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.3);
    font-size: 0.85rem;
    font-style: italic;
}

.transport-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tbtn {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: white;
    width: 52px; height: 52px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: all 0.18s;
}

.tbtn:hover:not(:disabled) {
    background: rgba(255,255,255,0.18);
    transform: translateY(-2px);
}

.tbtn:disabled { opacity: 0.3; cursor: not-allowed; }

.tbtn.tbtn-rec {
    width: 76px; height: 76px;
    background: var(--rec-red);
    border-color: var(--rec-red);
    box-shadow: 0 6px 20px rgba(220,38,38,0.5);
}

.tbtn.tbtn-rec:hover:not(:disabled) { background: #b91c1c; transform: translateY(-2px) scale(1.05); }
.tbtn.tbtn-rec.recording { animation: rec-glow 1.4s ease-in-out infinite; }

@keyframes rec-glow {
    0%, 100% { box-shadow: 0 6px 20px rgba(220,38,38,0.5); }
    50% { box-shadow: 0 6px 35px rgba(220,38,38,1); }
}

.tbtn.tbtn-play {
    width: 64px; height: 64px;
    background: var(--rec-green);
    border-color: var(--rec-green);
    box-shadow: 0 4px 16px rgba(22,163,74,0.4);
}
.tbtn.tbtn-play:hover:not(:disabled) { background: #15803d; }

.transport-extra {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.08);
    font-size: 0.78rem;
    color: rgba(255,255,255,0.6);
    flex-wrap: wrap;
    gap: 12px;
}

.speed-control { display: flex; align-items: center; gap: 6px; }
.speed-control span { color: rgba(255,255,255,0.6); font-size: 0.78rem; margin-right: 4px; }

.speed-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: white;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.74rem;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
}
.speed-btn.active { background: var(--primary); border-color: var(--primary); }

.format-info { display: inline-flex; align-items: center; gap: 6px; }
.format-info .badge {
    background: rgba(255,255,255,0.1);
    padding: 3px 9px;
    border-radius: 4px;
    font-family: 'SF Mono', monospace;
    font-size: 0.72rem;
    color: white;
    font-weight: 600;
}

.notes-toolbar {
    padding: 8px 14px;
    background: #fafbfc;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.notes-textarea {
    width: 100%;
    min-height: 140px;
    padding: 16px 20px;
    border: none;
    outline: none;
    resize: vertical;
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--dark);
    box-sizing: border-box;
}

.notes-textarea::placeholder { color: #94a3b8; }

.bookmark-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 200px;
    overflow-y: auto;
}

.bookmark-item {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: background 0.12s;
}

.bookmark-item:hover { background: #f8fafc; }

.bookmark-time {
    font-family: 'SF Mono', monospace;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--primary);
    background: #ecfeff;
    padding: 3px 8px;
    border-radius: 4px;
    min-width: 60px;
    text-align: center;
}

.bookmark-label { flex: 1; font-size: 0.85rem; color: var(--dark); }

.bookmark-del {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
}
.bookmark-del:hover { color: var(--rec-red); }

.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--dark);
    color: white;
    padding: 14px 20px;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 380px;
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast.success { background: #16a34a; }
.toast.error { background: #dc2626; }
.toast.warning { background: #d97706; }

.setting-row { margin-bottom: 14px; }
.setting-row label { display: block; font-size: 0.8rem; color: #475569; margin-bottom: 6px; font-weight: 600; }
.setting-row select, .setting-row input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.88rem;
    font-family: inherit;
    box-sizing: border-box;
}

.warning-banner {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-left: 4px solid #d97706;
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.88rem;
    color: #78350f;
}
.warning-banner svg { flex-shrink: 0; color: #d97706; margin-top: 2px; }
.warning-banner strong { color: #78350f; }
.warning-banner code { background: rgba(120,53,15,0.1); padding: 1px 6px; border-radius: 4px; font-family: 'SF Mono', monospace; font-size: 0.85em; }

.session-list::-webkit-scrollbar, .bookmark-list::-webkit-scrollbar { width: 6px; }
.session-list::-webkit-scrollbar-thumb, .bookmark-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
