/* ========================================
   CheckUp Exames — Sistema do Cliente
   Mobile-first CSS
   ======================================== */

:root {
    --primary: #00b894;
    --primary-dark: #00a381;
    --secondary: #0984e3;
    --gradient: linear-gradient(135deg, #00b894, #0984e3);
    --bg: #f0f4f3;
    --card-bg: #ffffff;
    --text: #2d3436;
    --text-light: #636e72;
    --text-muted: #b2bec3;
    --border: #dfe6e9;
    --danger: #d63031;
    --warning: #fdcb6e;
    --success: #00b894;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
}

* { 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);
    min-height: 100vh;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}

/* ---- Layout ---- */
.app-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    padding-bottom: 80px;
}

/* ---- Header ---- */
.app-header {
    background: var(--gradient);
    color: white;
    padding: 20px 20px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header .logo {
    height: 32px;
    filter: brightness(0) invert(1);
}

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

.header-greeting {
    font-size: 15px;
    opacity: 0.9;
}

.header-name {
    font-size: 22px;
    font-weight: 700;
}

.header-plan {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    margin-top: 6px;
}

.btn-logout {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
}

/* ---- Bottom Nav ---- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: white;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 11px;
    padding: 4px 6px;
    transition: color .2s;
}

.nav-item i { font-size: 20px; margin-bottom: 3px; }

.nav-item.active,
.nav-item:hover { color: var(--primary); }

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

.card-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title i { color: var(--primary); }

/* ---- Carteirinha ---- */
.carteirinha {
    background: var(--gradient);
    border-radius: 16px;
    padding: 24px;
    margin: 16px;
    color: white;
    position: relative;
    overflow: hidden;
}

.carteirinha::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -20%;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
}

.carteirinha-logo {
    height: 24px;
    filter: brightness(0) invert(1);
    margin-bottom: 16px;
}

.carteirinha-name {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.carteirinha-plan {
    font-size: 14px;
    opacity: 0.85;
    margin-bottom: 16px;
}

.carteirinha-bottom {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.carteirinha-number {
    font-size: 14px;
    font-family: monospace;
    letter-spacing: 1px;
}

.carteirinha-valid {
    font-size: 13px;
    opacity: 0.8;
}

.qr-container {
    background: white;
    border-radius: 12px;
    padding: 12px;
    display: inline-block;
    margin-top: 16px;
}

.qr-container canvas,
.qr-container img {
    width: 140px;
    height: 140px;
}

/* ---- Photo on Card ---- */
.carteirinha-photo-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
}

.carteirinha-photo {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.5);
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255,255,255,0.15);
}

.carteirinha-photo-placeholder {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 3px dashed rgba(255,255,255,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    opacity: 0.6;
    flex-shrink: 0;
    cursor: pointer;
    background: rgba(255,255,255,0.08);
}

.carteirinha-photo-info {
    flex: 1;
    min-width: 0;
}

.btn-change-photo {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-change-photo:active {
    background: rgba(255,255,255,0.3);
}

/* ---- Photo Tap Area ---- */
.photo-tap-area {
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
}
.photo-tap-area:active { opacity: 0.8; }
.photo-edit-badge {
    position: absolute;
    bottom: -2px; right: -2px;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: #00b894;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; color: #fff;
    border: 2px solid rgba(0,0,0,0.3);
    pointer-events: none;
}

/* ---- Photo Crop Modal ---- */
#cropModal {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85); z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    animation: fadeIn 0.2s;
}
.crop-modal-content {
    background: #1a1a2e; border-radius: 20px; padding: 20px;
    width: 340px; max-width: 95vw; text-align: center;
}
.crop-modal-header {
    display: flex; justify-content: space-between; align-items: center;
    color: #fff; font-size: 16px; font-weight: 700; margin-bottom: 16px;
}
.crop-close {
    background: none; border: none; color: #fff; font-size: 24px; cursor: pointer; opacity: 0.7;
}
.crop-close:hover { opacity: 1; }
.crop-area {
    position: relative; width: 300px; height: 300px;
    margin: 0 auto; border-radius: 16px; overflow: hidden;
    background: #000;
}
#cropCanvas { display: block; width: 300px; height: 300px; }
.crop-circle-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    background: radial-gradient(circle at center, transparent 130px, rgba(0,0,0,0.6) 131px);
    border: none;
}
.crop-circle-overlay::after {
    content: ''; position: absolute;
    top: 50%; left: 50%; transform: translate(-50%,-50%);
    width: 260px; height: 260px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.5);
}
.crop-zoom {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 10px 4px; color: rgba(255,255,255,0.6); font-size: 14px;
}
.crop-zoom input[type=range] {
    flex: 1; accent-color: #00b894; height: 4px;
}
.crop-hint {
    color: rgba(255,255,255,0.4); font-size: 12px; margin: 8px 0 16px;
}
.crop-actions {
    display: flex; gap: 10px;
}
.crop-btn { flex: 1; padding: 12px; border-radius: 12px; font-size: 14px; font-weight: 700; }
.crop-actions .btn-outline { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); color: #fff; }
.crop-actions .btn-primary { background: #00b894; border: none; color: #fff; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---- Card Request Status ---- */
.card-request-item {
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}

.card-request-item:last-child {
    border-bottom: none;
}

.card-request-status {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
}

.badge-processing {
    background: rgba(9,132,227,0.12);
    color: var(--secondary);
}

.badge-shipped {
    background: rgba(108,92,231,0.12);
    color: #6c5ce7;
}

.badge-delivered {
    background: rgba(0,184,148,0.15);
    color: var(--primary);
}

.tracking-code {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(9,132,227,0.08);
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 12px;
    color: var(--secondary);
    font-weight: 600;
    margin-top: 6px;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
    width: 100%;
}

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

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

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--primary);
    color: var(--primary);
}

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

.btn-sm {
    padding: 10px 18px;
    font-size: 13px;
    width: auto;
}

/* ---- Forms ---- */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    transition: border-color .2s;
    background: white;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
}

.form-select {
    width: 100%;
    padding: 14px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    background: white;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23636e72' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

/* ---- Lists ---- */
.list-item {
    display: flex;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.list-item:last-child { border-bottom: none; }

.list-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(0,184,148,0.1), rgba(9,132,227,0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 16px;
    flex-shrink: 0;
}

.list-content { flex: 1; min-width: 0; }
.list-title { font-size: 15px; font-weight: 600; }
.list-subtitle { font-size: 13px; color: var(--text-light); margin-top: 2px; }

.list-action {
    color: var(--text-muted);
    font-size: 14px;
}

/* ---- Status badges ---- */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success { background: rgba(0,184,148,0.15); color: var(--primary); }
.badge-warning { background: rgba(253,203,110,0.3); color: #e17055; }
.badge-danger  { background: rgba(214,48,49,0.12); color: var(--danger); }
.badge-info    { background: rgba(9,132,227,0.12); color: var(--secondary); }

/* ---- Quick Actions ---- */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin: 16px;
}

.quick-action {
    background: white;
    border-radius: var(--radius);
    padding: 20px 16px;
    text-align: center;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
    transition: transform .2s;
}

.quick-action:active { transform: scale(0.97); }

.quick-action i {
    font-size: 24px;
    color: var(--primary);
    margin-bottom: 8px;
    display: block;
}

.quick-action span {
    font-size: 13px;
    font-weight: 600;
}

/* ---- Section ---- */
.section-title {
    font-size: 17px;
    font-weight: 700;
    padding: 0 16px;
    margin-top: 24px;
    margin-bottom: 8px;
}

/* ---- Empty state ---- */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.empty-state i {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.empty-state p { font-size: 15px; }

/* ---- Loading ---- */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Toast ---- */
.toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text);
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 13px;
    z-index: 999;
    opacity: 0;
    transition: opacity .3s;
    max-width: 350px;
    text-align: center;
}

.toast.show { opacity: 1; }

/* ---- Modal ---- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: flex-end;
    justify-content: center;
}

.modal-overlay.active { display: flex; }

.modal {
    background: white;
    border-radius: 16px 16px 0 0;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 24px;
    animation: slideUp .3s ease;
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

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

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-light);
    cursor: pointer;
}

/* ---- Login ---- */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.login-card {
    background: white;
    border-radius: 16px;
    padding: 40px 24px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.login-card .logo {
    height: 48px;
    margin-bottom: 24px;
}

.login-card h1 {
    font-size: 24px;
    margin-bottom: 8px;
}

.login-card p {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 28px;
}

/* ---- Price ---- */
.price-original {
    text-decoration: line-through;
    color: var(--danger);
    font-size: 13px;
}

.price-final {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.price-discount {
    background: rgba(0,184,148,0.12);
    color: var(--primary);
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 700;
}

/* ---- Responsive ---- */
@media (min-width: 481px) {
    .app-container {
        border-left: 1px solid var(--border);
        border-right: 1px solid var(--border);
    }
}

/* ---- Utilities ---- */
/* ---- Results Page ---- */
.result-status-card {
    text-align: center;
    padding: 28px 20px;
    border-radius: var(--radius);
    margin: 16px;
    background: var(--card-bg);
    box-shadow: var(--shadow);
}

.result-status-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin-bottom: 12px;
}

.result-status-icon.status-completed { background: rgba(0,184,148,0.15); color: var(--primary); }
.result-status-icon.status-in_progress { background: rgba(9,132,227,0.12); color: var(--secondary); }
.result-status-icon.status-authorized { background: rgba(0,184,148,0.15); color: var(--primary); }
.result-status-icon.status-cancelled { background: rgba(214,48,49,0.12); color: var(--danger); }
.result-status-icon.status-default { background: rgba(253,203,110,0.3); color: #e17055; }

.result-status-label {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 6px;
}

.result-status-msg {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.5;
}

.result-timeline {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 16px;
    position: relative;
}

.result-timeline::before {
    content: '';
    position: absolute;
    top: 36px;
    left: 40px;
    right: 40px;
    height: 3px;
    background: var(--border);
    z-index: 0;
}

.timeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 1;
    flex: 1;
}

.timeline-dot {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    color: white;
    margin-bottom: 6px;
    transition: all .3s;
}

.timeline-dot.active {
    background: var(--primary);
}

.timeline-dot.done {
    background: var(--primary);
}

.timeline-label {
    font-size: 10px;
    color: var(--text-muted);
    text-align: center;
    max-width: 60px;
}

.timeline-label.active {
    color: var(--primary);
    font-weight: 700;
}

.text-center { text-align: center; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.gap-8 { gap: 8px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.hidden { display: none !important; }
