/* ============================================
   COMPONENTES REUTILIZABLES - I.E.P.E. Apóstol Pablo
   Cards, badges, avatars, spinners, botones sociales
   ============================================ */

/* ============================================
   CARDS
   ============================================ */
.card {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 1rem;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 1rem;
}

.card-header-line {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 3px solid var(--color-success);
}

.card-header-line .card-title {
    margin-bottom: 0;
}

/* ============================================
   AVATARS
   ============================================ */
.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 600;
    color: white;
    background: var(--color-primary);
}

.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 0.85rem;
}

.avatar-md {
    width: 40px;
    height: 40px;
    font-size: 1rem;
}

.avatar-lg {
    width: 44px;
    height: 44px;
    font-size: 1.1rem;
}

.avatar-xl {
    width: 60px;
    height: 60px;
    font-size: 1.5rem;
}

.avatar svg {
    width: 60%;
    height: 60%;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
    width: fit-content;
    font-weight: 500;
}

.badge-default {
    background: #e5e7eb;
    color: #374151;
}

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

.badge-success {
    background: var(--color-success);
    color: white;
}

.badge-warning {
    background: var(--color-warning);
    color: white;
}

.badge-error {
    background: var(--color-error);
    color: white;
}

.badge-director {
    background: var(--color-primary);
    color: white;
}

.badge-docente {
    background: var(--color-success);
    color: white;
}

.badge-admin {
    background: #8b5cf6;
    color: white;
}

/* ============================================
   SPINNERS Y LOADING
   ============================================ */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-dark {
    border-color: rgba(0,0,0,0.1);
    border-top-color: var(--color-primary);
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5e7eb;
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

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

.loading-card,
.empty-state {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
}

/* ============================================
   BOTONES SOCIALES
   ============================================ */
.social-links {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}

.social-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.social-btn svg {
    width: 18px;
    height: 18px;
}

.social-btn.facebook {
    background: #1877f2;
    color: white;
}

.social-btn.twitter {
    background: #1da1f2;
    color: white;
}

.social-btn.youtube {
    background: #ff0000;
    color: white;
}

.social-btn.instagram {
    background: #E1306C;
    color: white;
}

.social-btn:hover {
    transform: scale(1.1);
}

/* ============================================
   INDICADORES
   ============================================ */
.online-indicator {
    width: 8px;
    height: 8px;
    background: var(--color-success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

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

/* ============================================
   BOTONES DE ACCION
   ============================================ */
.tool-btn {
    width: 36px;
    height: 36px;
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.tool-btn:hover {
    background: #f3f4f6;
    color: var(--color-primary);
}

.tool-btn svg {
    width: 20px;
    height: 20px;
}

.menu-btn,
.flag-btn {
    width: 32px;
    height: 32px;
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-btn:hover,
.flag-btn:hover {
    background: #f3f4f6;
    color: #6b7280;
}

.menu-btn svg,
.flag-btn svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   BOTONES DE REACCION
   ============================================ */
.reaction-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.reaction-btn:hover {
    background: #f3f4f6;
    color: var(--color-primary);
}

.reaction-btn.liked {
    color: var(--color-error);
}

.reaction-btn.liked:hover {
    background: #fef2f2;
}

.reaction-btn svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   TEXTO VACIO / NO DATA
   ============================================ */
.no-data {
    color: #9ca3af;
    font-size: 0.85rem;
    text-align: center;
    padding: 0.5rem 0;
}

/* ============================================
   MINI CHARTS
   ============================================ */
.chart-legend {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-color.egresos { background: #f87171; }
.legend-color.ingresos { background: #a3e635; }

.mini-chart {
    height: 80px;
    display: flex;
    flex-direction: column;
}

.chart-bar {
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 2rem;
}

.chart-bar .bar {
    width: 40px;
    border-radius: 4px 4px 0 0;
}

.chart-bar .bar.egresos { background: #f87171; }
.chart-bar .bar.ingresos { background: #a3e635; }

.chart-labels {
    display: flex;
    justify-content: space-around;
    font-size: 0.7rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* ============================================
   CALENDARIO WIDGET
   ============================================ */
.calendar-widget {
    background: var(--color-primary);
    color: white;
}

.calendar-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.calendar-day {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1;
}

.calendar-date-info {
    display: flex;
    flex-direction: column;
}

.calendar-weekday {
    font-size: 1.1rem;
    font-weight: 600;
    text-transform: capitalize;
}

.calendar-month {
    font-size: 0.85rem;
    opacity: 0.9;
    text-transform: capitalize;
}

.btn-add-event {
    margin-left: auto;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.btn-add-event:hover {
    background: rgba(255,255,255,0.3);
}

.btn-add-event svg {
    width: 20px;
    height: 20px;
}

.calendar-events {
    text-align: center;
    padding: 1rem 0;
}

.no-events {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.no-events-icon svg {
    width: 80px;
    height: 80px;
    opacity: 0.5;
}

.event-item {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 6px;
    background: rgba(255,255,255,0.1);
    margin-bottom: 0.5rem;
}

.event-time {
    font-weight: 600;
}

.event-title {
    opacity: 0.9;
}

/* ============================================
   BIRTHDAY WIDGET
   ============================================ */
.birthday-widget {
    text-align: center;
}

.birthday-content {
    padding: 1rem 0;
}

.birthday-icon svg {
    width: 60px;
    height: 60px;
    margin-bottom: 0.75rem;
}

.birthday-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.25rem;
}

.birthday-count {
    font-size: 0.85rem;
    color: #6b7280;
    margin-bottom: 1rem;
}

.btn-see-all {
    background: var(--color-primary);
    color: white;
    border: none;
    padding: 0.6rem 1.5rem;
    border-radius: 20px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-see-all:hover {
    background: var(--color-primary-hover);
}

/* ============================================
   SECCIONES
   ============================================ */
.section {
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

/* ============================================
   STAT CARDS (Tarjetas de estadisticas)
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-normal);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 28px;
    height: 28px;
}

.stat-blue .stat-icon {
    background: rgba(0, 85, 163, 0.15);
    color: var(--color-card-blue);
}

.stat-orange .stat-icon {
    background: rgba(245, 158, 11, 0.15);
    color: var(--color-card-orange);
}

.stat-green .stat-icon {
    background: rgba(34, 197, 94, 0.15);
    color: var(--color-card-green);
}

.stat-yellow .stat-icon {
    background: rgba(245, 166, 35, 0.15);
    color: var(--color-highlight);
}

.stat-purple .stat-icon {
    background: rgba(139, 92, 246, 0.15);
    color: var(--color-card-purple);
}

.stat-info h3 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1;
}

.stat-info p {
    color: var(--text-gray);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* ============================================
   ACTION CARDS (Acciones rapidas)
   ============================================ */
.actions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.action-card {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-normal);
    text-align: center;
}

.action-card:hover {
    background: var(--color-primary);
    color: var(--text-white);
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.action-icon {
    width: 48px;
    height: 48px;
    background: rgba(0, 85, 163, 0.1);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    transition: var(--transition-normal);
}

.action-card:hover .action-icon {
    background: rgba(255,255,255,0.2);
    color: var(--text-white);
}

.action-icon svg {
    width: 24px;
    height: 24px;
}

.action-card span {
    font-weight: 500;
    font-size: 0.9rem;
}

/* ============================================
   ACTIVITY / TIMELINE
   ============================================ */
.activity-card {
    background: var(--bg-white);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
}

.activity-dot {
    width: 10px;
    height: 10px;
    border-radius: var(--radius-full);
    margin-top: 0.4rem;
    flex-shrink: 0;
}

.dot-blue { background: var(--color-card-blue); }
.dot-green { background: var(--color-card-green); }
.dot-orange { background: var(--color-card-orange); }
.dot-red { background: var(--color-card-red); }
.dot-purple { background: var(--color-card-purple); }

.activity-content p {
    color: var(--text-dark);
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

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

/* ============================================
   BOTON CON ICONO
   ============================================ */
.btn-icon {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--color-primary);
    color: white;
    border: none;
    padding: 0.6rem 1.25rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.btn-icon:hover:not(:disabled) {
    background: var(--color-primary-hover);
}

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

.btn-icon svg {
    width: 18px;
    height: 18px;
}

/* ============================================
   TEXTAREA LIMPIO
   ============================================ */
.textarea-clean {
    width: 100%;
    border: none;
    resize: none;
    font-size: 0.95rem;
    color: #374151;
    outline: none;
    font-family: inherit;
}

.textarea-clean::placeholder {
    color: #9ca3af;
}

/* ============================================
   GRIDS RESPONSIVE
   ============================================ */
@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .actions-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .stats-grid { grid-template-columns: 1fr; }
    .actions-grid { grid-template-columns: 1fr; }
}

/* ============================================
   TOAST NOTIFICATIONS (Global)
   Esquina superior derecha - Diseño moderno
   ============================================ */
.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 999999;
    max-width: 380px;
    min-width: 300px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: toastSlideIn 0.35s cubic-bezier(0.21, 1.02, 0.73, 1);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.toast-icon {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    padding: 4px;
}

.toast-icon svg {
    width: 100%;
    height: 100%;
}

.toast-message {
    flex: 1;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.5;
    letter-spacing: 0.01em;
}

.toast-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    opacity: 0.8;
    transition: all 0.2s ease;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toast-close:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.toast-close svg {
    width: 14px;
    height: 14px;
}

/* Toast Types - Colores modernos con gradientes sutiles */
.toast-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.toast-error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.toast-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.toast-info {
    background: linear-gradient(135deg, #0055A3 0%, #00407a 100%);
    color: white;
}

/* Animacion desde arriba hacia abajo */
@keyframes toastSlideIn {
    from {
        transform: translateY(-120%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-120%);
        opacity: 0;
    }
}

.toast-leaving {
    animation: toastSlideOut 0.3s cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
}

.toast + .toast {
    margin-top: 0.75rem;
}

/* Responsive - Movil */
@media (max-width: 480px) {
    .toast-container {
        top: 1rem;
        left: 1rem;
        right: 1rem;
        max-width: none;
        min-width: unset;
    }

    .toast {
        padding: 0.875rem 1rem;
    }

    .toast-message {
        font-size: 0.85rem;
    }
}
