/* ============================================
   CUSTOM DATEPICKER STYLES
   ============================================ */

.form-control[data-datepicker="true"] {
    cursor: pointer;
    background: var(--bg-white);
    position: relative;
}

.form-control[data-datepicker="true"]::after {
    content: '\f073';
    font-family: 'Font Awesome 5 Free';
    font-weight: 900;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

/* Datepicker Container */
.custom-datepicker {
    position: absolute;
    z-index: 9999;
    width: 280px;
    padding: 0.85rem;
    border-radius: 18px;
    background: var(--bg-white);
    border: 1px solid rgba(148, 163, 184, 0.4);
    box-shadow: 0 25px 50px rgba(15, 23, 42, 0.18);
    display: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.custom-datepicker.is-open {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* Datepicker Header */
.datepicker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.datepicker-header button {
    border: none;
    background: #f1f5f9;
    color: #0f172a;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 0.2s ease;
    font-size: 0.875rem;
}

.datepicker-header button:hover {
    background: rgba(14, 165, 233, 0.18);
    color: var(--primary-color);
    transform: scale(1.1);
}

.datepicker-header button:active {
    transform: scale(0.95);
}

.datepicker-month {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    flex: 1;
    text-align: center;
}

/* Weekdays */
.datepicker-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.datepicker-weekdays span {
    text-align: center;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #64748b;
    font-weight: 600;
    padding: 0.25rem 0;
}

/* Days Grid */
.datepicker-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.25rem;
}

/* Day Buttons */
.datepicker-day {
    border: none;
    background: transparent;
    padding: 0.45rem 0;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #0f172a;
    transition: all 0.15s ease;
    font-weight: 500;
    position: relative;
}

.datepicker-day:hover:not(.is-outside) {
    background: rgba(14, 165, 233, 0.1);
    color: var(--primary-color);
    transform: scale(1.1);
}

.datepicker-day:active {
    transform: scale(0.95);
}

.datepicker-day.is-outside {
    color: #94a3b8;
    opacity: 0.4;
    cursor: default;
}

.datepicker-day.is-outside:hover {
    background: transparent;
    transform: none;
}

.datepicker-day.is-today {
    border: 2px solid rgba(14, 165, 233, 0.6);
    font-weight: 700;
}

.datepicker-day.is-selected {
    background: linear-gradient(135deg, #0ea5e9, #22c55e);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.datepicker-day.is-selected:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(14, 165, 233, 0.4);
}

/* Animation for day buttons */
@keyframes dayPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.datepicker-day.is-selected {
    animation: dayPulse 0.3s ease;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .custom-datepicker {
        width: 100%;
        max-width: 320px;
        left: 50% !important;
        transform: translateX(-50%) translateY(-10px);
    }

    .custom-datepicker.is-open {
        transform: translateX(-50%) translateY(0);
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    .custom-datepicker {
        background: #1e293b;
        border-color: #334155;
    }

    .datepicker-month {
        color: #f1f5f9;
    }

    .datepicker-header button {
        background: #334155;
        color: #f1f5f9;
    }

    .datepicker-header button:hover {
        background: rgba(14, 165, 233, 0.25);
    }

    .datepicker-weekdays span {
        color: #94a3b8;
    }

    .datepicker-day {
        color: #f1f5f9;
    }

    .datepicker-day.is-outside {
        color: #64748b;
    }
}

/* Loading state for datepicker */
.datepicker-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 18px;
    z-index: 10;
}

.datepicker-loading::after {
    content: '';
    width: 24px;
    height: 24px;
    border: 3px solid var(--primary-color);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Accessibility improvements */
.datepicker-day:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.datepicker-header button:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Disabled state */
.datepicker-day[disabled],
.datepicker-day[aria-disabled="true"] {
    opacity: 0.3;
    cursor: not-allowed;
    pointer-events: none;
}

/* Range selection support (future enhancement) */
.datepicker-day.is-in-range {
    background: rgba(14, 165, 233, 0.15);
    color: var(--primary-color);
}

.datepicker-day.is-range-start,
.datepicker-day.is-range-end {
    background: linear-gradient(135deg, #0ea5e9, #22c55e);
    color: white;
    font-weight: 700;
}

/* Tooltip for dates */
.datepicker-day[title]::after {
    content: attr(title);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    margin-bottom: 4px;
}

.datepicker-day[title]:hover::after {
    opacity: 1;
}

/*------------------------------------------
   END OF CUSTOM DATEPICKER STYLES
   ------------------------------------ */
   /* ============================================
   NOTIFICATION SYSTEM
   ============================================ */

.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    min-width: 320px;
    max-width: 420px;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    font-size: 0.9375rem;
    line-height: 1.5;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

/* Notification Types */
.notification-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
}

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

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

.notification-info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

/* Icon styles */
.notification i.fas {
    font-size: 1.5rem;
    flex-shrink: 0;
    opacity: 0.9;
}

.notification span {
    flex: 1;
}

/* Close button */
.notification-close {
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    font-size: 0.75rem;
}

.notification-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.notification-close:active {
    transform: scale(0.9);
}

/* Progress bar */
.notification-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 0 0 12px 12px;
    width: 100%;
    animation: notificationProgress 4s linear forwards;
}

@keyframes notificationProgress {
    from {
        width: 100%;
    }
    to {
        width: 0%;
    }
}

/* Notification Container */
.notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    pointer-events: none;
}

.notification-container .notification {
    pointer-events: all;
    position: relative;
    top: auto;
    right: auto;
}

/* Stack effect when multiple notifications */
.notification-container .notification:nth-child(1) {
    transform: translateX(0) translateY(0);
}

.notification-container .notification:nth-child(2) {
    transform: translateX(0) translateY(0) scale(0.95);
    opacity: 0.9;
}

.notification-container .notification:nth-child(3) {
    transform: translateX(0) translateY(0) scale(0.9);
    opacity: 0.7;
}

.notification-container .notification:nth-child(n+4) {
    display: none;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .notification,
    .notification-container {
        right: 10px;
        left: 10px;
        min-width: auto;
        max-width: none;
    }

    .notification {
        padding: 0.875rem 1rem;
        font-size: 0.875rem;
    }

    .notification i.fas {
        font-size: 1.25rem;
    }
}

/* Character counter for textareas */
.character-counter {
    text-align: right;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    transition: color 0.2s ease;
}

.character-counter.warning {
    color: var(--warning-color);
    font-weight: 600;
}

.character-counter.danger {
    color: var(--danger-color);
    font-weight: 700;
}

/* Selected file name display */
.selected-file-name {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(34, 197, 94, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #15803d;
    font-size: 0.9375rem;
    font-weight: 500;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.selected-file-name i {
    font-size: 1.25rem;
}

.selected-file-name strong {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Confetti animation */
.confetti {
    position: fixed;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    opacity: 1;
}

/* Loading spinner for submit button */
.btn-submit .fa-spinner {
    animation: spin 1s linear infinite;
}

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

/* Focus visible improvements */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

button:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Skip link for accessibility */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 0.75rem 1.5rem;
    text-decoration: none;
    border-radius: 0 0 8px 0;
    z-index: 10001;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
}

/* Form loading overlay */
.form-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.form-loading-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.form-loading-overlay .spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(14, 165, 233, 0.2);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.form-loading-overlay .loading-text {
    margin-top: 1.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Smooth scroll behavior */
html {
    scroll-behavior: smooth;
}

/* Selection color */
::selection {
    background: rgba(14, 165, 233, 0.2);
    color: var(--text-primary);
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-light);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Print styles for notifications */
@media print {
    .notification,
    .notification-container,
    .form-loading-overlay,
    .confetti {
        display: none !important;
    }
}