/* Agencita Calendar Styles - Shared between Admin and Public */
/* Version 2.0 - Enhanced UI/UX with accessibility and modern design */

:root {
    /* Color Palette - Professional & Accessible */
    --ac-primary: #2563eb;
    --ac-primary-hover: #1d4ed8;
    --ac-primary-active: #1e40af;

    /* Event Status Colors (WCAG AA compliant) */
    --ac-color-confirmed: #10b981;
    --ac-color-pending: #f59e0b;
    --ac-color-cancelled: #ef4444;

    /* Neutral Colors */
    --ac-bg: #ffffff;
    --ac-border: #e5e7eb;
    --ac-border-hover: #2563eb;
    --ac-text-primary: #111827;
    --ac-text-secondary: #6b7280;
    --ac-text-muted: #9ca3af;

    /* Interactive States */
    --ac-hover-bg: #f3f4f6;
    --ac-selected-bg: #2563eb;
    --ac-today-bg: #eff6ff;
    --ac-event-bg: #fef3c7;
    --ac-event-bg-hover: #fde68a;

    /* Shadows */
    --ac-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --ac-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --ac-transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --ac-transition-normal: 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --ac-bg: #1f2937;
        --ac-border: #374151;
        --ac-border-hover: #60a5fa;
        --ac-text-primary: #f9fafb;
        --ac-text-secondary: #d1d5db;
        --ac-text-muted: #9ca3af;
        --ac-hover-bg: #374151;
        --ac-today-bg: #1e3a8a;
    }
}

.agencita-calendar {
    width: 100%;
    max-width: 100%;
    background: var(--ac-bg);
    border: 1px solid var(--ac-border);
    border-radius: 12px;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    box-shadow: var(--ac-shadow-sm);
    color: var(--ac-text-primary);
}

/* Header */
.ac-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--ac-border);
}

.ac-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--ac-text-primary);
    letter-spacing: -0.01em;
}

/* Navigation Buttons - Improved touch targets and accessibility */
.ac-btn {
    background: var(--ac-primary);
    color: #ffffff;
    border: none;
    width: 44px;  /* WCAG minimum touch target */
    height: 44px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--ac-transition-normal);
    box-shadow: var(--ac-shadow-sm);
    position: relative;
}

.ac-btn:hover {
    background: var(--ac-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--ac-shadow-md);
}

.ac-btn:active {
    background: var(--ac-primary-active);
    transform: translateY(0);
    box-shadow: var(--ac-shadow-sm);
}

.ac-btn:focus {
    outline: 2px solid var(--ac-primary);
    outline-offset: 2px;
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .ac-btn,
    .ac-day {
        transition: none;
        transform: none !important;
    }
}

/* Weekdays */
.ac-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 8px;
}

.ac-weekday {
    text-align: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--ac-text-secondary);
    padding: 10px 0;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Days Grid */
.ac-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.ac-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--ac-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--ac-transition-normal);
    position: relative;
    background: var(--ac-bg);
    min-height: 50px;
    font-weight: 500;
    color: var(--ac-text-primary);
}

.ac-day:hover:not(.ac-other-month) {
    background: var(--ac-hover-bg);
    border-color: var(--ac-border-hover);
    box-shadow: var(--ac-shadow-sm);
    z-index: 1;
}

.ac-day:focus {
    outline: 2px solid var(--ac-primary);
    outline-offset: -2px;
    z-index: 2;
}

.ac-day.ac-today {
    background: var(--ac-today-bg);
    border-color: var(--ac-primary);
    font-weight: 700;
}

.ac-day.ac-today .ac-day-number {
    color: var(--ac-primary);
}

.ac-day.ac-selected {
    background: var(--ac-selected-bg);
    color: #ffffff;
    border-color: var(--ac-primary-active);
    box-shadow: var(--ac-shadow-md);
    z-index: 3;
}

.ac-day.ac-selected .ac-day-number,
.ac-day.ac-selected .ac-event-dot {
    color: #ffffff;
}

.ac-day.ac-other-month {
    color: var(--ac-text-muted);
    background: transparent;
    cursor: default;
    opacity: 0.4;
}

.ac-day.ac-other-month:hover {
    background: transparent;
    border-color: var(--ac-border);
    box-shadow: none;
}

.ac-day-number {
    font-size: 0.95rem;
    line-height: 1;
}

/* Event Indicator - Improved visibility */
.ac-event-dot {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: var(--ac-color-cancelled);
    color: #ffffff;
    font-size: 0.75rem;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ac-day.ac-has-events {
    background: var(--ac-event-bg);
}

.ac-day.ac-has-events:hover {
    background: var(--ac-event-bg-hover);
}

/* Legend - Improved spacing and contrast */
.ac-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--ac-border);
    font-size: 0.875rem;
}

.ac-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ac-text-secondary);
}

.ac-legend-color {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    display: inline-block;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Responsive Design - Mobile First */
@media (max-width: 640px) {
    .agencita-calendar {
        padding: 16px;
        border-radius: 8px;
    }

    .ac-title {
        font-size: 1.125rem;
    }

    .ac-btn {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }

    .ac-weekday {
        font-size: 0.75rem;
        padding: 8px 0;
    }

    .ac-day {
        min-height: 44px;
        font-size: 0.875rem;
    }

    .ac-event-dot {
        width: 18px;
        height: 18px;
        font-size: 0.7rem;
        bottom: 4px;
        right: 4px;
    }

    .ac-legend {
        gap: 12px;
        font-size: 0.8125rem;
    }
}

/* WordPress Admin specific adjustments */
.wp-admin .agencita-calendar {
    margin-top: 20px;
    max-width: 95%; /* Responsive to container */
    padding: 16px; /* Smaller padding */
}

.wp-admin .ac-title {
    font-size: 1.1rem; /* Smaller title */
}

.wp-admin .ac-btn {
    background: var(--ac-primary);
    width: 40px; /* Smaller buttons in admin */
    height: 40px;
}

.wp-admin .ac-btn:hover {
    background: var(--ac-primary-hover);
}

.wp-admin .ac-btn:active {
    background: var(--ac-primary-active);
}

.wp-admin .ac-day {
    min-height: 45px; /* Smaller cells in admin */
    font-size: 0.9rem;
}

.wp-admin .ac-weekday {
    font-size: 0.8rem; /* Smaller weekday headers */
}

.wp-admin .ac-day.ac-today .ac-day-number {
    color: var(--ac-primary);
}

.wp-admin .ac-day.ac-selected {
    background: var(--ac-primary);
    border-color: var(--ac-primary-active);
}

/* Disabled days (non-working days) */
.wp-admin .ac-day.ac-disabled {
    background: #f6f7f7;
    color: #c3c4c7;
    cursor: not-allowed;
    opacity: 0.5;
}

.wp-admin .ac-day.ac-disabled:hover {
    background: #f6f7f7;
    border-color: var(--ac-border);
    box-shadow: none;
    cursor: not-allowed;
}


/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .agencita-calendar {
        border-width: 2px;
    }

    .ac-day {
        border-width: 2px;
    }

    .ac-btn:focus,
    .ac-day:focus {
        outline-width: 3px;
    }
}

/* Print Styles */
@media print {
    .agencita-calendar {
        box-shadow: none;
        border: 1px solid #000;
    }

    .ac-btn {
        display: none;
    }

    .ac-day:hover {
        background: var(--ac-bg) !important;
    }
}


/* ================================
   WEEK VIEW STYLES
   ================================ */

/* View Selector (Toggle) */
.ac-view-selector {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding: 4px;
    background: var(--ac-hover-bg, #f3f4f6);
    border-radius: 8px;
}

.ac-view-btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--ac-text-secondary);
    transition: all var(--ac-transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.ac-view-btn:hover {
    background: rgba(255, 255, 255, 0.5);
    color: var(--ac-text-primary);
}

.ac-view-btn.active {
    background: var(--ac-bg, #ffffff);
    color: var(--ac-primary);
    box-shadow: var(--ac-shadow-sm);
    font-weight: 600;
}

.ac-view-btn:focus-visible {
    outline: 2px solid var(--ac-primary);
    outline-offset: 2px;
}

/* Week View Container */
.ac-week-view {
    border: 1px solid var(--ac-border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--ac-bg);
}

/* Week Header (Day Columns) */
.ac-week-header {
    display: grid;
    grid-template-columns: 70px repeat(5, 1fr);
    background: var(--ac-hover-bg, #f8f9fa);
    border-bottom: 2px solid var(--ac-border);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--ac-text-primary);
}

.ac-time-column,
.ac-day-column {
    padding: 12px 8px;
    text-align: center;
    border-right: 1px solid var(--ac-border);
}

.ac-day-column:last-child {
    border-right: none;
}

.ac-day-column.ac-today {
    background: var(--ac-today-bg, #eff6ff);
    color: var(--ac-primary);
    font-weight: 700;
}

/* Week Body (Time Slots) */
.ac-week-body {
    max-height: 600px;
    overflow-y: auto;
}

/* Time Row */
.ac-time-row {
    display: grid;
    grid-template-columns: 70px repeat(5, 1fr);
    border-bottom: 1px solid #e5e7eb;
    min-height: 50px;
}

.ac-time-row:hover {
    background: var(--ac-hover-bg, #f9fafb);
}

.ac-time-cell {
    padding: 8px;
    font-size: 0.75rem;
    color: var(--ac-text-secondary);
    border-right: 1px solid var(--ac-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
}

.ac-appointment-cell {
    padding: 4px;
    border-right: 1px solid var(--ac-border);
    position: relative;
    min-height: 50px;
}

.ac-appointment-cell:last-child {
    border-right: none;
}

.ac-appointment {
    padding: 6px 8px;
    margin: 2px 0;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--ac-transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
    line-height: 1.3;
}

.ac-appointment:hover {
    transform: translateY(-1px);
    box-shadow: var(--ac-shadow-sm);
}

.ac-appt-icon { font-weight: bold; flex-shrink: 0; font-size: 0.9rem; }
.ac-appt-title { font-weight: 500; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-appt-client { font-size: 0.75rem; opacity: 0.8; font-style: italic; }

.ac-appt-confirmed { background: #d1fae5; border-left: 3px solid #10b981; color: #065f46; }
.ac-appt-pending { background: #fef3c7; border-left: 3px solid #f59e0b; color: #92400e; }
.ac-appt-cancelled { background: #fee2e2; border-left: 3px solid #ef4444; color: #991b1b; opacity: 0.7; text-decoration: line-through; }
.ac-appt-completed { background: #e0e7ff; border-left: 3px solid #6366f1; color: #3730a3; }
.ac-appt-no_show { background: #f3f4f6; border-left: 3px solid #6b7280; color: #374151; opacity: 0.6; }

@media (max-width: 768px) {
    .ac-view-selector { flex-direction: column; }
    .ac-week-header, .ac-time-row { grid-template-columns: 60px repeat(3, 1fr); }
    .ac-day-column:nth-child(5), .ac-day-column:nth-child(6),
    .ac-appointment-cell:nth-child(5), .ac-appointment-cell:nth-child(6) { display: none; }
    .ac-appointment { font-size: 0.75rem; padding: 4px 6px; }
    .ac-appt-client { display: none; }
}
