/* ── Plataforma de Mastologia ─────────────────────────────── */

:root {
    --primary: #1a5276;
    --primary-light: #2980b9;
    --bg: #f5f6fa;
    --card-bg: #ffffff;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --border: #dcdde1;
    --success: #27ae60;
    --warning: #f39c12;
    --danger: #e74c3c;
    --radius: 12px;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ── Header ─────────────────────────────────────────────── */
header {
    background: var(--primary);
    color: white;
    padding: 12px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-top {
    max-width: 900px;
    margin: 0 auto;
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.logo {
    font-size: 1.3rem;
    font-weight: 700;
    text-decoration: none;
    color: white;
}

.subtitle {
    font-size: 0.85rem;
    opacity: 0.85;
}

/* ── Main ───────────────────────────────────────────────── */
main {
    max-width: 900px;
    margin: 20px auto;
    padding: 0 16px 60px;
}

/* ── Cards ──────────────────────────────────────────────── */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 16px;
}

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

.card-header h2 {
    font-size: 1.15rem;
    color: var(--primary);
}

/* ── Botões ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}

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

.btn-success {
    background: var(--success);
    color: white;
}
.btn-success:hover { opacity: 0.9; }

.btn-danger {
    background: var(--danger);
    color: white;
}
.btn-danger:hover { opacity: 0.9; }

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-light);
    color: var(--primary-light);
}
.btn-outline:hover { background: var(--primary-light); color: white; }

.btn-sm {
    padding: 5px 12px;
    font-size: 0.85rem;
}

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

/* ── Lista de Pacientes ─────────────────────────────────── */
.paciente-list {
    list-style: none;
}

.paciente-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}

.paciente-item:last-child { border-bottom: none; }
.paciente-item:hover { background: #f8f9fa; }

.paciente-info h3 {
    font-size: 1rem;
    color: var(--text);
}

.paciente-info span {
    font-size: 0.8rem;
    color: var(--text-light);
}

.paciente-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

/* ── Formulários ────────────────────────────────────────── */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    transition: border-color 0.15s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(41,128,185,0.1);
}

.form-group textarea {
    min-height: 80px;
    resize: vertical;
}

/* ── Prontuário ─────────────────────────────────────────── */
.prontuario {
    font-family: "SF Mono", "Menlo", "Consolas", monospace;
    font-size: 0.9rem;
    line-height: 1.7;
    background: #fafafa;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 70vh;
    overflow-y: auto;
}

/* ── Exames Grid ────────────────────────────────────────── */
.exames-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

.exame-card {
    background: #f8f9fa;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
}

.exame-card .tipo {
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.exame-card .meta {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 6px;
}

.exame-card .achados {
    font-size: 0.9rem;
    color: var(--text);
}

/* ── Upload Zone ────────────────────────────────────────── */
.upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary-light);
    background: #eef5fb;
}

.upload-zone input[type="file"] {
    display: none;
}

.upload-zone .icon {
    font-size: 2.5rem;
    margin-bottom: 8px;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.preview-item .remove {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 0.8rem;
    cursor: pointer;
}

/* ── Gravador ───────────────────────────────────────────── */
.recorder {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: #fef9e7;
    border: 1px solid #f9e79f;
    border-radius: var(--radius);
}

.recorder .status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--text-light);
}

.recorder.recording .status-dot {
    background: var(--danger);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.recorder .timer {
    font-family: monospace;
    font-size: 1.1rem;
    min-width: 50px;
}

/* ── Toast / Alert ──────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-weight: 500;
}

.alert-success { background: #d5f5e3; color: #1e7e34; border: 1px solid #82e0aa; }
.alert-error   { background: #fadbd8; color: #922b21; border: 1px solid #f1948a; }
.alert-info    { background: #d6eaf8; color: #1a5276; border: 1px solid #85c1e9; }

/* ── Tabs ───────────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--border);
}

.tab-btn {
    padding: 10px 18px;
    border: none;
    background: none;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
}

.tab-btn.active {
    color: var(--primary-light);
    border-bottom-color: var(--primary-light);
}

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

/* ── Mobile ─────────────────────────────────────────────── */
@media (max-width: 600px) {
    header { padding: 10px 14px; }
    .logo { font-size: 1.1rem; }
    .subtitle { font-size: 0.7rem; }
    main { padding: 0 10px 40px; }
    .card { padding: 14px; }
    .btn { padding: 8px 16px; font-size: 0.9rem; }
}
