/* ================================================
   ARCADE DATETIME PICKER STYLING 🎮⏰
   Custom styling for datetime-local inputs
================================================ */

/* -------------------------------------------
   BASE DATETIME INPUT STYLING
------------------------------------------- */

input[type="datetime-local"],
input[type="date"],
input[type="time"] {
    /* Size and spacing */
    padding: 0.75rem 1rem !important;
    font-size: 1rem !important;
    font-weight: 600 !important;
    font-family: 'Rubik', -apple-system, sans-serif !important;
    
    /* Arcade colors */
    background: linear-gradient(135deg, var(--cp-bg-2) 0%, var(--cp-bg-3) 100%) !important;
    color: var(--cp-brand) !important;
    border: 2px solid var(--cp-border) !important;
    border-radius: 10px !important;
    
    /* Effects */
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(0, 217, 255, 0.1) !important;
    transition: all 200ms ease !important;
    
    /* Text styling */
    letter-spacing: 0.5px !important;
    text-transform: uppercase !important;
}

/* Hover state */
input[type="datetime-local"]:hover,
input[type="date"]:hover,
input[type="time"]:hover {
    border-color: var(--cp-brand) !important;
    box-shadow: 
        0 0 15px var(--cp-brand-glow),
        0 6px 16px rgba(0, 0, 0, 0.4),
        inset 0 1px 0 rgba(0, 217, 255, 0.2) !important;
    transform: translateY(-1px) !important;
}

/* Focus state */
input[type="datetime-local"]:focus,
input[type="date"]:focus,
input[type="time"]:focus {
    border-color: var(--cp-brand) !important;
    background: var(--cp-bg-3) !important;
    box-shadow: 
        0 0 0 3px rgba(0, 217, 255, 0.25),
        0 0 20px var(--cp-brand-glow),
        0 8px 20px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(0, 217, 255, 0.3) !important;
    outline: none !important;
}

/* -------------------------------------------
   CALENDAR/CLOCK ICON STYLING
------------------------------------------- */

/* Style the calendar/clock icon (browser-specific) */
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
    background-image: none !important;
    cursor: pointer;
    filter: brightness(0) saturate(100%) invert(62%) sepia(89%) saturate(2527%) hue-rotate(161deg) brightness(101%) contrast(101%);
    opacity: 0.8;
    transition: all 150ms ease;
    padding: 8px;
    margin-left: 8px;
    border-radius: 6px;
    background: rgba(0, 217, 255, 0.1);
}

input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
input[type="date"]::-webkit-calendar-picker-indicator:hover,
input[type="time"]::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
    background: rgba(0, 217, 255, 0.2);
    box-shadow: 0 0 10px var(--cp-brand-glow);
}

/* Custom icon using Unicode (emoji fallback) */
input[type="datetime-local"]::before {
    content: '📅';
    margin-right: 8px;
    font-size: 1.1em;
}

input[type="date"]::before {
    content: '📅';
    margin-right: 8px;
    font-size: 1.1em;
}

input[type="time"]::before {
    content: '⏰';
    margin-right: 8px;
    font-size: 1.1em;
}

/* -------------------------------------------
   PLACEHOLDER STYLING
------------------------------------------- */

input[type="datetime-local"]::-webkit-datetime-edit-text,
input[type="datetime-local"]::-webkit-datetime-edit-month-field,
input[type="datetime-local"]::-webkit-datetime-edit-day-field,
input[type="datetime-local"]::-webkit-datetime-edit-year-field,
input[type="datetime-local"]::-webkit-datetime-edit-hour-field,
input[type="datetime-local"]::-webkit-datetime-edit-minute-field,
input[type="datetime-local"]::-webkit-datetime-edit-ampm-field {
    color: var(--cp-brand) !important;
    font-weight: 700 !important;
    text-shadow: 0 0 8px var(--cp-brand-glow);
}

/* Empty/placeholder state */
input[type="datetime-local"]::-webkit-datetime-edit-text[value=""]:not(:focus),
input[type="date"]::-webkit-datetime-edit-text[value=""]:not(:focus),
input[type="time"]::-webkit-datetime-edit-text[value=""]:not(:focus) {
    color: var(--cp-text-3) !important;
}

/* -------------------------------------------
   SMALL SIZE VARIANT (form-control-sm)
------------------------------------------- */

input[type="datetime-local"].form-control-sm,
input[type="date"].form-control-sm,
input[type="time"].form-control-sm {
    padding: 0.5rem 0.75rem !important;
    font-size: 0.9rem !important;
    border-radius: 8px !important;
}

/* -------------------------------------------
   DROPDOWN/POPUP CALENDAR STYLING
   (Limited browser support)
------------------------------------------- */

/* Chrome/Edge calendar popup */
input[type="datetime-local"]::-webkit-calendar-picker-indicator {
    width: 20px;
    height: 20px;
}

/* -------------------------------------------
   DISABLED STATE
------------------------------------------- */

input[type="datetime-local"]:disabled,
input[type="date"]:disabled,
input[type="time"]:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    filter: grayscale(0.8) !important;
}

input[type="datetime-local"]:disabled:hover,
input[type="date"]:disabled:hover,
input[type="time"]:disabled:hover {
    transform: none !important;
    border-color: var(--cp-border) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

/* -------------------------------------------
   VALIDATION STATES
------------------------------------------- */

/* Invalid state */
input[type="datetime-local"]:invalid,
input[type="date"]:invalid,
input[type="time"]:invalid {
    border-color: var(--cp-neon-pink) !important;
    box-shadow: 
        0 0 15px rgba(255, 0, 110, 0.4),
        0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

/* Valid state */
input[type="datetime-local"]:valid,
input[type="date"]:valid,
input[type="time"]:valid {
    border-color: var(--cp-brand) !important;
}

/* -------------------------------------------
   WRAPPER ENHANCEMENTS
------------------------------------------- */

/* Add a wrapper class for extra styling */
.cp-datetime-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
}

/* Icon before input */
.cp-datetime-wrapper::before {
    content: '⏰';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    pointer-events: none;
    z-index: 1;
    opacity: 0.7;
}

.cp-datetime-wrapper input {
    padding-left: 2.5rem !important;
}

/* -------------------------------------------
   ARCADE GLOW ANIMATION
------------------------------------------- */

@keyframes datetimeGlow {
    0%, 100% {
        box-shadow: 
            0 0 15px var(--cp-brand-glow),
            0 6px 16px rgba(0, 0, 0, 0.4);
    }
    50% {
        box-shadow: 
            0 0 25px var(--cp-brand-glow),
            0 8px 20px rgba(0, 0, 0, 0.5);
    }
}

input[type="datetime-local"]:focus,
input[type="date"]:focus,
input[type="time"]:focus {
    animation: datetimeGlow 2s ease-in-out infinite;
}

/* -------------------------------------------
   TOGGLE SWITCH STYLING (for schedule toggle)
------------------------------------------- */

.form-check-input {
    width: 3rem !important;
    height: 1.5rem !important;
    background-color: var(--cp-bg-2) !important;
    border: 2px solid var(--cp-border) !important;
    cursor: pointer !important;
    transition: all 200ms ease !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

.form-check-input:hover {
    border-color: var(--cp-brand) !important;
    box-shadow: 0 0 10px var(--cp-brand-glow) !important;
}

.form-check-input:checked {
    background-color: var(--cp-brand) !important;
    border-color: var(--cp-brand) !important;
    box-shadow: 
        0 0 15px var(--cp-brand-glow),
        0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

.form-check-input:focus {
    box-shadow: 
        0 0 0 3px rgba(0, 217, 255, 0.25),
        0 0 15px var(--cp-brand-glow) !important;
    border-color: var(--cp-brand) !important;
}

.form-check-label {
    color: var(--cp-text) !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    user-select: none !important;
}

/* -------------------------------------------
   MOBILE RESPONSIVE
------------------------------------------- */

@media (max-width: 576px) {
    input[type="datetime-local"],
    input[type="date"],
    input[type="time"] {
        padding: 0.65rem 0.875rem !important;
        font-size: 0.95rem !important;
    }
    
    .form-check-input {
        width: 2.5rem !important;
        height: 1.25rem !important;
    }
}

/* -------------------------------------------
   FIREFOX SPECIFIC FIXES
------------------------------------------- */

@-moz-document url-prefix() {
    input[type="datetime-local"],
    input[type="date"],
    input[type="time"] {
        padding-right: 0.5rem !important;
    }
}

/* -------------------------------------------
   DARK THEME ENHANCEMENTS
------------------------------------------- */

/* Ensure text is readable in popups */
input[type="datetime-local"]::-webkit-calendar-picker-indicator,
input[type="date"]::-webkit-calendar-picker-indicator {
    /* Browser handles this, but we can add hover effects */
}

/* -------------------------------------------
   LABEL STYLING FOR DATETIME INPUTS
------------------------------------------- */

label[for*="Date"],
label[for*="Time"],
.cp-datetime-label {
    color: var(--cp-text) !important;
    font-weight: 700 !important;
    font-size: 0.95rem !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    margin-bottom: 0.5rem !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
}

/* Icon in label */
.cp-datetime-label::before {
    content: '📅';
    font-size: 1.1em;
}
