/* DentScribe Voice Scribe — Professional Dental Theme */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
    --primary: #1a73e8;
    --primary-dark: #1557b0;
    --primary-light: #e8f0fe;
    --success: #0f9d58;
    --danger: #d93025;
    --warning: #f9ab00;
    --bg: #f8fafb;
    --card: #ffffff;
    --text: #202124;
    --text-muted: #5f6368;
    --border: #dadce0;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(60,64,67,0.15), 0 1px 2px rgba(60,64,67,0.1);
    --shadow-lg: 0 4px 12px rgba(60,64,67,0.15);
}
body {
    font-family: 'Google Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* === AUTH VIEWS === */
.auth-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 20px;
    background: linear-gradient(135deg, #e8f0fe 0%, #f8fafb 100%);
}
.auth-card {
    background: var(--card);
    border-radius: 16px;
    padding: 48px 40px;
    box-shadow: var(--shadow-lg);
    max-width: 440px;
    width: 100%;
    text-align: center;
}
.auth-logo { font-size: 48px; margin-bottom: 16px; }
.auth-title { font-size: 24px; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.auth-subtitle { font-size: 14px; color: var(--text-muted); margin-bottom: 32px; line-height: 1.5; }

#g_id_onload, .g_id_signin { display: inline-block; }
.pending-message {
    background: #fff8e1;
    border: 1px solid var(--warning);
    border-radius: var(--radius);
    padding: 24px;
    margin-top: 24px;
}
.pending-message h3 { color: #e65100; margin-bottom: 8px; }
.pending-message p { color: var(--text-muted); font-size: 14px; }

/* === WAITLIST FORM === */
.waitlist-form {
    text-align: left;
    margin-top: 24px;
}
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,115,232,0.1);
}
.form-group input[readonly] {
    background: #f1f3f4;
    color: var(--text-muted);
}
.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: #94a3b8; cursor: not-allowed; }


/* === MAIN APP LAYOUT === */
.app-container { display: none; }
.app-container.active { display: block; }
.header {
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow);
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-left h1 { font-size: 18px; font-weight: 700; color: var(--primary); }
.header-left span { font-size: 12px; color: var(--text-muted); }
.header-right { display: flex; align-items: center; gap: 12px; }
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid var(--border);
}
.user-name { font-size: 13px; font-weight: 500; color: var(--text); }
.btn-signout {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: none;
    font-size: 12px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s;
}
.btn-signout:hover { background: #f1f3f4; color: var(--danger); border-color: var(--danger); }
.btn-admin {
    padding: 6px 12px;
    border: 1px solid var(--primary);
    border-radius: 6px;
    background: var(--primary-light);
    font-size: 12px;
    cursor: pointer;
    color: var(--primary);
    font-weight: 500;
}
.btn-admin:hover { background: var(--primary); color: white; }

/* === TABS === */
.tabs {
    display: flex;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 56px;
    z-index: 99;
}
.tab {
    flex: 1;
    padding: 12px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab:hover { background: var(--primary-light); }
.page { display: none; padding: 20px; max-width: 800px; margin: 0 auto; }
.page.active { display: block; }


/* === RECORD PAGE === */
.record-container {
    display: flex; flex-direction: column; align-items: center; gap: 24px; padding-top: 40px;
}
.timer { font-size: 48px; font-weight: 300; font-variant-numeric: tabular-nums; color: var(--text); }
.record-btn {
    width: 120px; height: 120px; border-radius: 50%; border: 4px solid var(--danger);
    background: transparent; cursor: pointer; display: flex; align-items: center;
    justify-content: center; transition: all 0.3s;
}
.record-btn .inner {
    width: 48px; height: 48px; background: var(--danger); border-radius: 50%; transition: all 0.3s;
}
.record-btn.recording .inner { width: 32px; height: 32px; border-radius: 6px; }
.record-btn.recording { animation: pulse 1.5s infinite; }
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(217,48,37,0.4); }
    50% { box-shadow: 0 0 0 20px rgba(217,48,37,0); }
}
.patient-input {
    width: 100%; max-width: 300px; padding: 12px 16px; border: 1px solid var(--border);
    border-radius: var(--radius); font-size: 16px; text-align: center; outline: none;
}
.patient-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,115,232,0.1); }
.status-msg { font-size: 14px; color: var(--text-muted); text-align: center; min-height: 20px; }
.status-msg.recording { color: var(--danger); font-weight: 600; }
.status-msg.uploading { color: var(--warning); }
.status-msg.success { color: var(--success); }
.status-msg.error { color: var(--danger); }
.progress-bar {
    width: 100%; max-width: 300px; height: 6px; background: var(--border);
    border-radius: 3px; overflow: hidden; display: none;
}
.progress-bar.active { display: block; }
.progress-bar .fill { height: 100%; background: var(--primary); border-radius: 3px; transition: width 0.3s; width: 0%; }

/* === UPLOAD PAGE === */
.upload-container { display: flex; flex-direction: column; align-items: center; gap: 20px; padding-top: 40px; }
.upload-area {
    width: 100%; max-width: 400px; border: 2px dashed var(--border); border-radius: var(--radius);
    padding: 40px 20px; text-align: center; cursor: pointer; transition: all 0.2s;
}
.upload-area:hover { border-color: var(--primary); background: rgba(26,115,232,0.03); }
#fileInput { display: none; }

/* === NOTES PAGE === */
.notes-list { display: flex; flex-direction: column; gap: 12px; }
.note-card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px; cursor: pointer; transition: all 0.2s;
}
.note-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.note-card .note-date { font-size: 12px; color: var(--text-muted); }
.note-card .note-label { font-size: 15px; font-weight: 600; margin-top: 4px; }
.note-card .note-status {
    font-size: 12px; margin-top: 6px; padding: 2px 8px; border-radius: 4px; display: inline-block;
}
.note-status.completed { background: #e6f4ea; color: #137333; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }


/* === MODAL === */
.modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 1000; padding: 20px; overflow-y: auto;
}
.modal-overlay.active { display: flex; align-items: flex-start; justify-content: center; }
.modal {
    background: var(--card); border-radius: var(--radius); width: 100%;
    max-width: 700px; margin-top: 40px; padding: 24px; position: relative;
}
.modal-close {
    position: absolute; top: 16px; right: 16px; background: none;
    border: none; font-size: 24px; cursor: pointer; color: var(--text-muted);
}
.modal h2 { font-size: 18px; margin-bottom: 16px; padding-right: 40px; }
.soap-note { font-size: 14px; line-height: 1.7; white-space: pre-wrap; }
.copy-btn {
    display: block; width: 100%; padding: 14px; background: var(--primary);
    color: white; border: none; border-radius: var(--radius); font-size: 16px;
    font-weight: 600; cursor: pointer; margin-top: 20px;
}
.copy-btn:hover { background: var(--primary-dark); }
.copy-btn.copied { background: var(--success); }

/* === ADMIN PANEL === */
.admin-container { display: none; }
.admin-container.active { display: block; }
.admin-stats {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px; margin-bottom: 24px;
}
.stat-card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 20px; text-align: center;
}
.stat-card .stat-value { font-size: 32px; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.admin-section { margin-bottom: 32px; }
.admin-section h3 { font-size: 16px; font-weight: 600; margin-bottom: 12px; color: var(--text); }
.waitlist-entry {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px; margin-bottom: 12px; display: flex; justify-content: space-between;
    align-items: center; flex-wrap: wrap; gap: 12px;
}
.waitlist-info { flex: 1; min-width: 200px; }
.waitlist-info .name { font-weight: 600; font-size: 15px; }
.waitlist-info .details { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.waitlist-actions { display: flex; gap: 8px; }
.btn-approve {
    padding: 8px 16px; background: var(--success); color: white; border: none;
    border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer;
}
.btn-reject {
    padding: 8px 16px; background: var(--danger); color: white; border: none;
    border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer;
}
.btn-back {
    padding: 8px 16px; border: 1px solid var(--border); border-radius: 6px;
    background: none; font-size: 13px; cursor: pointer; color: var(--text-muted); margin-bottom: 20px;
}
.btn-back:hover { background: #f1f3f4; }
.wake-lock-notice {
    background: #fff8e1; border: 1px solid var(--warning); border-radius: var(--radius);
    padding: 12px 16px; font-size: 13px; color: #e65100; text-align: center; max-width: 320px;
}
.refresh-btn {
    background: none; border: 1px solid var(--border); border-radius: 8px;
    padding: 8px 16px; font-size: 13px; cursor: pointer; color: var(--text-muted);
}
.refresh-btn:hover { background: #f1f3f4; }
.hidden { display: none; }
