/* yo.griito — Diseño espectacular morado */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
    --purple-900: #2e1065;
    --purple-800: #3b0764;
    --purple-700: #4a1a8a;
    --purple-600: #6c2bd9;
    --purple-500: #8b5cf6;
    --purple-400: #a78bfa;
    --purple-300: #c4b5fd;
    --purple-200: #ddd6fe;
    --purple-100: #ede9fe;
    --purple-50: #f5f3ff;
    --white: #ffffff;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --red: #ef4444;
    --green: #10b981;
    --green-light: #d1fae5;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
    --shadow-md: 0 10px 25px -5px rgba(107,43,217,.15), 0 8px 10px -6px rgba(107,43,217,.08);
    --shadow-lg: 0 20px 40px -10px rgba(107,43,217,.25);
    --shadow-glow: 0 0 40px rgba(139,92,246,.3);
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container { max-width: 960px; margin: 0 auto; padding: 0 1.5rem; width: 100%; }

/* ═══ Navbar ═══ */
.navbar {
    background: linear-gradient(135deg, var(--purple-900) 0%, var(--purple-700) 40%, var(--purple-600) 100%);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(46,16,101,.4);
    backdrop-filter: blur(10px);
}
.navbar::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--purple-400), transparent);
}
.nav-content { display: flex; align-items: center; justify-content: space-between; }
.logo { text-decoration: none; font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; }
.logo-yo { color: var(--white); }
.logo-dot { color: var(--purple-400); font-size: 2rem; }
.logo-griito { color: var(--purple-300); }
.nav-links { display: flex; align-items: center; gap: 1.5rem; }
.nav-links a {
    color: rgba(255,255,255,.8);
    text-decoration: none;
    font-size: .9rem;
    font-weight: 500;
    transition: all .2s;
    padding: .4rem .75rem;
    border-radius: 8px;
}
.nav-links a:hover { color: var(--white); background: rgba(255,255,255,.1); }
.nav-user {
    color: rgba(255,255,255,.6);
    font-size: .8rem;
    background: rgba(255,255,255,.08);
    padding: .3rem .75rem;
    border-radius: 20px;
}

/* ═══ Main ═══ */
main { flex: 1; padding: 2.5rem 0; }

/* ═══ Cards ═══ */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 2.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(139,92,246,.06);
    position: relative;
    overflow: hidden;
}
.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--purple-600), var(--purple-400), var(--purple-600));
}
.card-header { margin-bottom: 2rem; }
.card-header h2 {
    font-size: 1.6rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--purple-900), var(--purple-600));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -.02em;
}
.card-header p { color: var(--gray-500); margin-top: .4rem; font-size: .95rem; }

/* ═══ Forms ═══ */
.form-group { margin-bottom: 1.5rem; }
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: .5rem;
    color: var(--gray-700);
    font-size: .9rem;
    letter-spacing: .01em;
}
.form-control {
    width: 100%;
    padding: .85rem 1.1rem;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: inherit;
    transition: all .25s ease;
    outline: none;
    background: var(--white);
}
.form-control:focus {
    border-color: var(--purple-500);
    box-shadow: 0 0 0 4px rgba(139,92,246,.12), var(--shadow);
}
.form-control::placeholder { color: var(--gray-500); opacity: .6; }
textarea.form-control {
    resize: vertical;
    min-height: 140px;
    line-height: 1.6;
}

/* ═══ Buttons ═══ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    padding: .85rem 2rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all .25s ease;
    text-decoration: none;
    letter-spacing: .01em;
}
.btn-primary {
    background: linear-gradient(135deg, var(--purple-700), var(--purple-500));
    color: var(--white);
    box-shadow: 0 4px 15px rgba(107,43,217,.35);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(107,43,217,.45);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
    opacity: .4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.btn-outline {
    background: rgba(255,255,255,.1);
    border: 2px solid rgba(255,255,255,.3);
    color: var(--white);
    padding: .4rem 1rem;
    font-size: .85rem;
    backdrop-filter: blur(4px);
}
.btn-outline:hover { border-color: var(--white); background: rgba(255,255,255,.15); }
.btn-sm { padding: .4rem 1rem; font-size: .85rem; }
.btn-block { width: 100%; }
.btn-record {
    background: linear-gradient(135deg, #dc2626, var(--red));
    color: var(--white);
    width: 90px;
    height: 90px;
    border-radius: 50%;
    font-size: .75rem;
    font-weight: 800;
    letter-spacing: .05em;
    border: 5px solid rgba(239,68,68,.2);
    box-shadow: 0 8px 30px rgba(239,68,68,.3);
    transition: all .3s ease;
}
.btn-record:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 40px rgba(239,68,68,.4);
}
.btn-record.recording {
    animation: pulse 1.5s infinite;
    background: linear-gradient(135deg, #b91c1c, #dc2626);
    border-color: rgba(239,68,68,.4);
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.5), 0 8px 30px rgba(239,68,68,.3); }
    50% { box-shadow: 0 0 0 20px rgba(239,68,68,0), 0 8px 30px rgba(239,68,68,.3); }
}

/* ═══ Recorder ═══ */
.recorder-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    padding: 2.5rem;
    background: linear-gradient(135deg, var(--purple-50), var(--purple-100));
    border-radius: var(--radius);
    border: 2px dashed var(--purple-300);
    position: relative;
    overflow: hidden;
}
/* shimmer removed — was blocking touch events on iOS */
.recorder-status { color: var(--gray-500); font-size: .9rem; }
.recorder-timer {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--purple-700);
    font-variant-numeric: tabular-nums;
    letter-spacing: .02em;
}
#audioPreview {
    width: 100%;
    max-width: 400px;
    margin-top: .5rem;
    border-radius: 8px;
}
.btn-record { position: relative; z-index: 10; }

/* ═══ Recipients ═══ */
.recipients-info { display: flex; gap: 1rem; margin-top: .75rem; }
.recipients-count {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem 1rem;
    background: linear-gradient(135deg, var(--purple-100), var(--purple-50));
    color: var(--purple-700);
    border-radius: 25px;
    font-size: .85rem;
    font-weight: 700;
    border: 1px solid var(--purple-200);
}

/* ═══ Alerts ═══ */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-size: .9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.alert-error {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    color: #991b1b;
    border: 1px solid #fecaca;
}
.alert-success {
    background: linear-gradient(135deg, #f0fdf4, #dcfce7);
    color: #166534;
    border: 1px solid #bbf7d0;
}
.alert-info {
    background: linear-gradient(135deg, var(--purple-50), var(--purple-100));
    color: var(--purple-800);
    border: 1px solid var(--purple-200);
}

/* ═══ Auth pages ═══ */
.auth-container {
    max-width: 460px;
    margin: 3rem auto;
}
.auth-container .card {
    padding: 3rem;
    box-shadow: var(--shadow-lg);
}
.auth-container h1 {
    text-align: center;
    font-size: 2.5rem;
    font-weight: 900;
    margin-bottom: .5rem;
    letter-spacing: -.03em;
}
.auth-container .subtitle {
    text-align: center;
    color: var(--gray-500);
    margin-bottom: 2.5rem;
    font-size: 1.05rem;
}
.auth-switch {
    text-align: center;
    margin-top: 2rem;
    color: var(--gray-500);
    font-size: .9rem;
}
.auth-switch a {
    color: var(--purple-600);
    font-weight: 700;
    text-decoration: none;
    transition: color .2s;
}
.auth-switch a:hover { color: var(--purple-800); }

/* ═══ Hero background ═══ */
body.auth-page {
    background: linear-gradient(160deg, var(--purple-900) 0%, var(--purple-800) 30%, var(--gray-50) 30%);
}

/* ═══ Footer ═══ */
.footer {
    padding: 2rem 0;
    text-align: center;
    color: var(--gray-500);
    font-size: .85rem;
    border-top: 1px solid var(--gray-200);
}
.footer a {
    color: var(--purple-600);
    text-decoration: none;
    font-weight: 600;
}

/* ═══ Historial ═══ */

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}
.stat-card {
    text-align: center;
    padding: 1.25rem .75rem;
    background: linear-gradient(135deg, var(--purple-50), var(--purple-100));
    border-radius: var(--radius-sm);
    border: 1px solid var(--purple-200);
}
.stat-number {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--purple-700);
    letter-spacing: -.02em;
}
.stat-label {
    font-size: .75rem;
    color: var(--gray-500);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-top: .25rem;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}
.empty-icon { font-size: 3rem; margin-bottom: 1rem; }
.empty-state h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gray-700);
    margin-bottom: .5rem;
}
.empty-state p { color: var(--gray-500); }

/* Batch cards */
.batch-card {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    margin-bottom: .75rem;
    overflow: hidden;
    transition: box-shadow .2s;
}
.batch-card:hover { box-shadow: var(--shadow); }
.batch-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.15rem 1.25rem;
    cursor: pointer;
    transition: background .15s;
    user-select: none;
}
.batch-header:hover { background: var(--purple-50); }
.batch-info { flex: 1; min-width: 0; }
.batch-title {
    display: flex;
    align-items: center;
    gap: .5rem;
    font-size: 1rem;
}
.batch-icon { font-size: 1.2rem; }
.batch-meta {
    display: flex;
    gap: 1rem;
    margin-top: .35rem;
    font-size: .8rem;
    color: var(--gray-500);
}
.batch-count {
    background: var(--purple-100);
    color: var(--purple-700);
    padding: .1rem .5rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: .75rem;
}
.batch-right {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.batch-expand {
    font-size: 1.2rem;
    color: var(--gray-500);
    transition: transform .3s;
}
.batch-card.open .batch-expand { transform: rotate(180deg); }

/* Progress ring */
.progress-ring {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: conic-gradient(var(--green) calc(var(--pct) * 1%), var(--gray-200) 0);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}
.progress-ring::before {
    content: '';
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--white);
    position: absolute;
}
.progress-ring span {
    position: relative;
    z-index: 1;
    font-size: .65rem;
    font-weight: 800;
    color: var(--gray-700);
}

/* Batch details (collapsed by default) */
.batch-details {
    max-height: 0;
    overflow: hidden;
    transition: max-height .35s ease;
}
.batch-card.open .batch-details {
    max-height: 1000px;
}
.batch-stats-mini {
    display: flex;
    gap: .75rem;
    padding: .75rem 1.25rem;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
    border-bottom: 1px solid var(--gray-100);
}
.mini-stat {
    font-size: .8rem;
    font-weight: 600;
    color: var(--gray-700);
}

/* Call rows */
.call-list { padding: 0; }
.call-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1.25rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: .9rem;
    transition: background .1s;
}
.call-row:last-child { border-bottom: none; }
.call-row:hover { background: var(--purple-50); }
.call-phone { font-weight: 600; flex: 1; }
.call-duration {
    color: var(--gray-500);
    font-size: .8rem;
    margin-right: 1rem;
    font-variant-numeric: tabular-nums;
}
.call-status {
    font-weight: 700;
    font-size: .75rem;
    padding: .2rem .65rem;
    border-radius: 20px;
    white-space: nowrap;
}
.call-status.pending { background: var(--purple-100); color: var(--purple-700); }
.call-status.completed { background: var(--green-light); color: #065f46; }
.call-status.failed { background: #fef2f2; color: #991b1b; }
.call-status.cancelled { background: var(--gray-100); color: var(--gray-500); }

/* Cancel buttons */
.btn-cancel-call {
    background: none;
    border: 1.5px solid var(--red);
    color: var(--red);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: .8rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: .5rem;
    transition: all .2s;
    flex-shrink: 0;
}
.btn-cancel-call:hover {
    background: var(--red);
    color: var(--white);
    transform: scale(1.1);
}
.btn-cancel-call:disabled { opacity: .5; cursor: wait; }

.btn-cancel-batch {
    background: linear-gradient(135deg, #fef2f2, #fee2e2);
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: .3rem .75rem;
    border-radius: 8px;
    font-size: .75rem;
    font-weight: 700;
    cursor: pointer;
    margin-left: auto;
    transition: all .2s;
    font-family: inherit;
}
.btn-cancel-batch:hover {
    background: var(--red);
    color: var(--white);
    border-color: var(--red);
}
.btn-cancel-batch:disabled { opacity: .6; cursor: wait; }

/* ═══ Responsive ═══ */
@media (max-width: 640px) {
    .card { padding: 1.5rem; }
    .auth-container .card { padding: 2rem; }
    .auth-container h1 { font-size: 2rem; }
    .nav-links { gap: .75rem; }
    .nav-links a { padding: .3rem .5rem; font-size: .8rem; }
    .recorder-container { padding: 1.5rem; }
    .recorder-timer { font-size: 2rem; }
    .btn-record { width: 75px; height: 75px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .stat-number { font-size: 1.3rem; }
    .batch-meta { flex-direction: column; gap: .25rem; }
}
