/* Artifizio Calendario Legal - Estilos personalizados v0.6.0 */

/* Safe area para dispositivos con notch */
.safe-bottom {
    padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Navegación inferior */
.nav-btn {
    color: #627d98;
    transition: color 0.2s;
}
.nav-btn.active {
    color: #3b0f17;
}
.nav-btn.active svg {
    stroke-width: 2.5;
}

/* Cards */
.card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    padding: 1rem;
    transition: transform 0.15s, box-shadow 0.15s;
}
.card:active {
    transform: scale(0.98);
}

/* Timeline */
.timeline-item {
    position: relative;
    padding-left: 2rem;
    padding-bottom: 1.5rem;
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 1.75rem;
    bottom: 0;
    width: 2px;
    background: #e8cdc4;
}
.timeline-item:last-child::before {
    display: none;
}
.timeline-dot {
    position: absolute;
    left: 0;
    top: 0.25rem;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    border: 3px solid #e8cdc4;
    background: white;
    z-index: 1;
}
.timeline-dot.completado {
    background: #10b981;
    border-color: #10b981;
}
.timeline-dot.en-curso {
    background: #f59e0b;
    border-color: #f59e0b;
    animation: pulse-dot 2s infinite;
}
.timeline-dot.vencido {
    background: #ef4444;
    border-color: #ef4444;
}

@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
}

/* Wizard steps */
.step-indicator {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}
.step-dot {
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background: #e8cdc4;
    transition: background 0.3s, transform 0.3s;
}
.step-dot.active {
    background: #3b0f17;
    transform: scale(1.3);
}
.step-dot.done {
    background: #10b981;
}

/* Calendar grid */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    min-height: 40px;
}
.cal-day:active {
    transform: scale(0.9);
}
.cal-day.despacho {
    background: #d1fae5;
    color: #065f46;
}
.cal-day.no-despacho {
    background: #fee2e2;
    color: #991b1b;
}
.cal-day.sin-registrar {
    background: #f3f4f6;
    color: #6b7280;
}
.cal-day.fin-semana {
    background: #e5e7eb;
    color: #9ca3af;
}
.cal-day.vacacion {
    background: #fef3c7;
    color: #92400e;
}
.cal-day.sugerido {
    border: 2px dashed #60a5fa;
    background: #eff6ff;
    color: #1e40af;
}

/* Despacho tabs */
.despacho-tabs {
    display: flex;
    gap: 0.5rem;
    background: #f1f5f9;
    border-radius: 0.75rem;
    padding: 4px;
}
.despacho-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #64748b;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}
.despacho-tab.active {
    background: white;
    color: #3b0f17;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.despacho-tab[data-modo="bot"].active {
    color: #1e40af;
}
.despacho-bot-header {
    border-left: 3px solid #3b82f6;
}
.despacho-bot-card {
    border-left: 3px solid #93c5fd;
}

/* Disclaimer popup */
.despacho-disclaimer-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    transition: background 0.3s;
    pointer-events: none;
}
.despacho-disclaimer-overlay.active {
    background: rgba(0,0,0,0.5);
    pointer-events: auto;
}
.despacho-disclaimer-modal {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    max-width: 380px;
    width: 100%;
    text-align: center;
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s;
}
.despacho-disclaimer-overlay.active .despacho-disclaimer-modal {
    transform: scale(1);
    opacity: 1;
}
.despacho-disclaimer-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 0.75rem;
}
.cal-day.header {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 600;
    cursor: default;
}

/* Form styles */
.form-input {
    width: 100%;
    border: 1.5px solid #e8cdc4;
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: white;
}
.form-input:focus {
    border-color: #3b0f17;
    box-shadow: 0 0 0 3px rgba(59, 15, 23, 0.1);
}
.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #5c252d;
    margin-bottom: 0.375rem;
}

/* Selector cards */
.selector-card {
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.15s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.selector-card:active {
    transform: scale(0.98);
}
.selector-card.selected {
    border-color: #3b0f17;
    background: #fdf8f3;
}

/* Button */
.btn-primary {
    background: #3b0f17;
    color: white;
    padding: 0.875rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 1rem;
    width: 100%;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-primary:active {
    background: #4a1a22;
}
.btn-primary:disabled {
    background: #d4a89a;
    cursor: not-allowed;
}
.btn-secondary {
    background: white;
    color: #3b0f17;
    padding: 0.875rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 1rem;
    width: 100%;
    border: 2px solid #3b0f17;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-secondary:active {
    background: #fdf8f3;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-ordinario {
    background: #dbeafe;
    color: #1e40af;
}
.badge-breve {
    background: #fce7f3;
    color: #9d174d;
}

/* Loading spinner */
.spinner {
    border: 3px solid #e5e7eb;
    border-top: 3px solid #3b0f17;
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Search input */
.search-input-wrapper {
    position: relative;
}
.search-input-wrapper svg {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}
.search-input-wrapper input {
    padding-left: 2.5rem;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    width: 2.75rem;
    height: 1.5rem;
    background: #d1d5db;
    border-radius: 9999px;
    cursor: pointer;
    transition: background 0.3s;
}
.toggle-switch.active {
    background: #10b981;
}
.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 1.25rem;
    height: 1.25rem;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch.active::after {
    transform: translateX(1.25rem);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #7a3830;
}
.empty-state svg {
    width: 4rem;
    height: 4rem;
    margin: 0 auto 1rem;
    opacity: 0.5;
}

/* Auth pages */
.auth-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 2rem 1rem;
}
.auth-logo {
    text-align: center;
    margin-bottom: 2rem;
}
.auth-logo h2 {
    color: #3b0f17;
    font-size: 1.5rem;
    font-weight: 700;
}
.auth-logo p {
    color: #7a3830;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}
.auth-card {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.auth-link {
    color: #3b0f17;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
}

/* User menu dropdown */
.user-menu {
    position: relative;
}
.user-menu-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: #f4c9a9;
    color: #3b0f17;
    font-weight: 700;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 2px solid rgba(255,255,255,0.3);
}
.user-dropdown {
    position: absolute;
    right: 0;
    top: 2.5rem;
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 200px;
    overflow: hidden;
    z-index: 60;
    display: none;
}
.user-dropdown.open {
    display: block;
}
.user-dropdown-item {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.875rem;
    color: #5c252d;
    cursor: pointer;
    border: none;
    background: none;
}
.user-dropdown-item.danger {
    color: #dc2626;
}
.user-dropdown-divider {
    height: 1px;
    background: #e5e7eb;
}
/* Notifications bell */
.notif-menu {
    position: relative;
}
.notif-bell-btn {
    position: relative;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: rgba(255,255,255,0.85);
    background: none;
    border: none;
    transition: background 0.2s;
}
.notif-bell-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}
/* Contact button (header) */
.contact-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    transition: background 0.2s;
}
.contact-btn:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}
.notif-badge {
    position: absolute;
    top: 0;
    right: 0;
    min-width: 1rem;
    height: 1rem;
    padding: 0 0.25rem;
    border-radius: 999px;
    background: #dc2626;
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.notif-dropdown {
    position: absolute;
    right: 0;
    top: 2.5rem;
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    width: 320px;
    max-width: 90vw;
    overflow: hidden;
    z-index: 60;
    display: none;
}
.notif-dropdown.open {
    display: block;
}
.notif-dropdown-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e5e7eb;
}
.notif-dropdown-list {
    max-height: 360px;
    overflow-y: auto;
}
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.15s;
}
.notif-item:hover {
    background: #f9fafb;
}
.notif-item:last-child {
    border-bottom: none;
}
.notif-item-unread {
    background: #fdf8f3;
}
.notif-item-unread:hover {
    background: #faf0e4;
}
.notif-icon {
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    margin-top: 0.125rem;
}
.notif-icon-proximo {
    background: #fef3c7;
}
.notif-icon-vencido {
    background: #fee2e2;
    color: #dc2626;
    font-weight: 700;
}
.notif-item-body {
    flex: 1;
    min-width: 0;
}
.notif-item-msg {
    font-size: 0.8125rem;
    color: #1f2937;
    line-height: 1.3;
}
.notif-item-meta {
    font-size: 0.6875rem;
    color: #9ca3af;
    margin-top: 0.125rem;
}
.notif-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: #9ca3af;
    font-size: 0.875rem;
}

.admin-badge {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.625rem;
    font-weight: 700;
    background: #f4c9a9;
    color: #3b0f17;
    text-transform: uppercase;
}
.badge-divorcio {
    background: #fce7f3;
    color: #9d174d;
}
.badge-separacion {
    background: #f3e8ff;
    color: #6b21a8;
}
.section-header {
    font-size: 0.75rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.5rem 0;
    margin-top: 0.5rem;
}
/* Badge types */
.badge-amparo {
    background: #fef3c7;
    color: #92400e;
}
.badge-contencioso {
    background: #e0e7ff;
    color: #3730a3;
}
.badge-penal {
    background: #fce7f3;
    color: #9d174d;
}
.badge-especial {
    background: #ecfdf5;
    color: #065f46;
}

/* Tribunal collapsible groups */
.tribunal-group-header {
    cursor: pointer;
    user-select: none;
    touch-action: manipulation;
}
.tribunal-group-header:hover {
    background: #f9fafb;
}
.tribunal-group-header .chevron {
    transition: transform 0.2s;
}

/* Ficha card */
.ficha-card {
    border-left: 4px solid #3b0f17;
}

/* Calendario de hitos */
.cal-hito-day {
    position: relative;
    flex-direction: column;
    gap: 1px;
    background: #f9fafb;
}
.cal-hito-day:hover {
    background: #e5e7eb;
}
.cal-today {
    border: 2px solid #3b0f17;
    font-weight: 700;
}
.cal-hito-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
}
.cal-hito-count {
    position: absolute;
    top: 2px;
    right: 3px;
    font-size: 0.5rem;
    font-weight: 700;
    color: #6b7280;
    line-height: 1;
}

/* Popup overlay */
.cal-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 80;
}
.cal-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 1rem;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    max-width: 400px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 90;
}
.cal-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
}
.cal-popup-close {
    font-size: 1.5rem;
    color: #9ca3af;
    cursor: pointer;
    line-height: 1;
    background: none;
    border: none;
    padding: 0;
}
.cal-popup-close:hover {
    color: #374151;
}
.cal-popup-body {
    padding: 0.75rem 1.25rem 1.25rem;
}
.cal-popup-hito {
    padding: 0.75rem 0;
    border-bottom: 1px solid #f3f4f6;
}
.cal-popup-hito:last-child {
    border-bottom: none;
}

/* Badge recurso / civil */
.badge-recurso {
    background: #f0fdf4;
    color: #166534;
}
.badge-civil {
    background: #dbeafe;
    color: #1e40af;
}

/* Badges laboral + NNA + beta */
.badge-laboral {
    background: #fef3c7;
    color: #92400e;
}
.badge-nna {
    background: #e0e7ff;
    color: #3730a3;
}
.beta-badge {
    font-size: 0.6rem;
    background: #f4c9a9;
    color: #3b0f17;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    vertical-align: middle;
    font-weight: 700;
    letter-spacing: 0.05em;
}

/* Calendario hitos - colored cells */
.cal-hito-day.con-hitos {
    background: #dbeafe;
    color: #1e40af;
}
.cal-hito-day.hito-proximo {
    background: #fef3c7;
    color: #92400e;
}
.cal-hito-day.hito-vencido {
    background: #fee2e2;
    color: #991b1b;
}
.cal-hito-day.sin-hitos {
    background: #f3f4f6;
    color: #6b7280;
}

/* Requisito cards */
.requisito-card {
    transition: all 0.15s;
}
.requisito-card:hover {
    background: #fdf8f3;
}

/* Accordion for action groups */
.tribunal-group-header[data-group] {
    padding: 0.75rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    margin-bottom: 2px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.tribunal-group-header[data-group]:hover {
    background: #fdf8f3;
}
.tribunal-group-header[data-group] .chevron.rotate-180 {
    transform: rotate(180deg);
}
/* Spam/verification alert banner */
.spam-alert {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 0.75rem;
    padding: 0.875rem 1rem;
    margin-bottom: 1rem;
}
.spam-alert-content {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}
.spam-alert-icon {
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
    color: #2563eb;
    margin-top: 0.125rem;
}
.spam-alert-text {
    flex: 1;
    font-size: 0.875rem;
    color: #1e40af;
    line-height: 1.5;
}
.spam-alert-close {
    flex-shrink: 0;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: #60a5fa;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.spam-alert-close:hover {
    color: #2563eb;
}

/* Google Calendar */
.gcal-sync-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: #1a73e8;
    color: #fff;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}
.gcal-sync-btn:hover { background: #1558b0; }
.gcal-sync-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.gcal-connect-btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    background: #fff;
    color: #1a73e8;
    border: 1.5px solid #1a73e8;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    transition: all 0.2s;
}
.gcal-connect-btn:hover { background: #e8f0fe; }
.gcal-connect-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.gcal-connected {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    color: #16a34a;
    font-weight: 500;
}

/* ========== Expedientes Judiciales ========== */

/* Tabs */
.exp-tab {
    transition: all 0.15s;
    user-select: none;
}
.exp-tab:active {
    transform: scale(0.95);
}
.exp-tab.active {
    border-color: #3b0f17;
    color: #3b0f17;
    background: #fdf8f3;
}

/* Texto legal formateado */
.prose-legal {
    font-family: 'Georgia', 'Times New Roman', serif;
    line-height: 1.8;
    color: #1f2937;
}
.prose-legal p {
    margin-bottom: 1em;
    text-align: justify;
}
.prose-legal hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 1.5em 0;
}

/* Preview thumbnails */
.exp-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.5rem;
}
.exp-preview-thumb {
    position: relative;
    aspect-ratio: 3/4;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 2px solid #e5e7eb;
    background: #f9fafb;
}
.exp-preview-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.exp-preview-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
    line-height: 1;
}
.exp-preview-remove:hover {
    background: #dc2626;
}

/* Drop zone */
.exp-drop-zone {
    border: 2px dashed #d1d5db;
    border-radius: 0.75rem;
    padding: 2rem 1rem;
    text-align: center;
    color: #9ca3af;
    transition: all 0.2s;
    cursor: pointer;
}
.exp-drop-zone.dragover {
    border-color: #3b0f17;
    background: #fdf8f3;
    color: #3b0f17;
}

/* Progress bar */
.exp-progress-bar {
    height: 0.5rem;
    background: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}
.exp-progress-fill {
    height: 100%;
    background: #3b0f17;
    border-radius: 9999px;
    transition: width 0.3s ease;
}
.exp-progress-fill.animating {
    background: linear-gradient(90deg, #3b0f17 0%, #b25d49 50%, #3b0f17 100%);
    background-size: 200% 100%;
    animation: progress-shimmer 1.5s ease-in-out infinite;
}

@keyframes progress-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Estado badges */
.badge-exp {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 600;
}
.badge-en-cola {
    background: #fef3c7;
    color: #92400e;
}
.badge-procesando {
    background: #dbeafe;
    color: #1e40af;
}
.badge-analizando {
    background: #f3e8ff;
    color: #6b21a8;
}
.badge-completado {
    background: #d1fae5;
    color: #065f46;
}
.badge-error {
    background: #fee2e2;
    color: #991b1b;
}

/* PDF icon in exp list */
.exp-pdf-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: #fee2e2;
    color: #dc2626;
    font-size: 0.625rem;
    font-weight: 700;
}

/* No scrollbar utility */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}
.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}
