/* =============================================================
   CODERSTATION — FLOATING CALENDAR / DATE PICKER
   ============================================================= */

/* ---------------------------------------------------------
   Container
   --------------------------------------------------------- */
.coderstation-floating-calendar {
    position: relative;
    width: 100%;
    margin-bottom: 1.5rem;
}

/* ---------------------------------------------------------
   The input field
   --------------------------------------------------------- */
.coderstation-floating-calendar .floating-input {
    width: 100%;
    padding: 1rem 1rem 0.4rem 2.8rem;
    font-size: 1rem;
    color: var(--text-color, #1e293b);
    background: #ffffff;
    border: 1px solid var(--panel-border, #e2e8f0);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 5px rgba(6, 46, 82, 0.04);
    cursor: pointer;
}

.coderstation-floating-calendar .floating-input:hover:not(:focus):not(:disabled) {
    border-color: #cbd5e1;
}

.coderstation-floating-calendar .floating-input:focus,
.coderstation-floating-calendar .floating-input.active-picker {
    border-color: var(--button-background, #25549e);
    box-shadow: 0 0 0 3px rgba(37, 84, 158, 0.12);
}

/* ---------------------------------------------------------
   Floating label
   --------------------------------------------------------- */
.coderstation-floating-calendar .floating-label {
    position: absolute;
    top: 50%;
    left: 2.8rem;
    transform: translateY(-50%);
    font-size: 1rem;
    color: #64748b;
    pointer-events: none;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 0;
    background: transparent;
    line-height: 1.2;
}

.coderstation-floating-calendar .floating-input:focus ~ .floating-label,
.coderstation-floating-calendar .floating-input:not(:placeholder-shown) ~ .floating-label,
.coderstation-floating-calendar .floating-input.has-value ~ .floating-label,
.coderstation-floating-calendar .floating-input.active-picker ~ .floating-label {
    top: 0.1rem;
    transform: translateY(0);
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 400;
    background: transparent;
}

/* ---------------------------------------------------------
   Leading icon (left side)
   --------------------------------------------------------- */
.coderstation-floating-calendar .calendar-icon {
    position: absolute;
    top: 50%;
    left: 1rem;
    transform: translateY(-50%);
    font-size: 1rem;
    color: #94a3b8;
    transition: color 0.25s ease;
    pointer-events: none;
    z-index: 2;
    line-height: 1;
}

.coderstation-floating-calendar .floating-input:focus ~ .calendar-icon,
.coderstation-floating-calendar .floating-input.active-picker ~ .calendar-icon,
.coderstation-floating-calendar .floating-input.has-value ~ .calendar-icon {
    color: var(--button-background, #25549e);
}

/* ---------------------------------------------------------
   Dropdown arrow (right side)
   --------------------------------------------------------- */
.coderstation-floating-calendar .calendar-arrow {
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
    font-size: 0.85rem;
    color: #94a3b8;
    transition: color 0.25s ease, transform 0.25s ease;
    cursor: pointer;
    z-index: 2;
}

.coderstation-floating-calendar .floating-input.active-picker ~ .calendar-arrow {
    color: var(--button-background, #25549e);
    transform: translateY(-50%) rotate(180deg);
}

/* ---------------------------------------------------------
   Disabled calendar state
   --------------------------------------------------------- */
.coderstation-floating-calendar.calendar-disabled .floating-input {
    background: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
    border-color: #e2e8f0;
    box-shadow: none;
}

.coderstation-floating-calendar.calendar-disabled .calendar-icon {
    color: #cbd5e1;
}

.coderstation-floating-calendar.calendar-disabled .floating-label {
    color: #94a3b8;
}

/* ---------------------------------------------------------
   Edge browser specific input fix
   --------------------------------------------------------- */
.coderstation-floating-calendar input::-ms-clear,
.coderstation-floating-calendar input::-ms-reveal {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* =============================================================
   CUSTOM DROPDOWN CALENDAR PLUGIN (GLOBAL POPUP)
   ============================================================= */
.coderstation-calendar-popup {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 9999999 !important;
    background: #ffffff;
    border: 1px solid var(--panel-border, #e5e7eb);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.18);
    width: 236px;
    min-width: 236px;
    padding: 8px;
    font-family: inherit, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    display: none;
    flex-direction: column;
    gap: 4px;
    box-sizing: border-box !important;
}

.coderstation-calendar-popup,
.coderstation-calendar-popup * {
    box-sizing: border-box !important;
}

.coderstation-calendar-popup.active {
    display: flex !important;
    animation: calFadeIn 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes calFadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Header */
.coderstation-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-color, #f8fafc);
    padding: 3px 6px;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
}

.coderstation-calendar-header button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color, #1e293b);
    font-size: 0.85rem;
    width: 24px;
    height: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}

.coderstation-calendar-header button:hover {
    background: rgba(37, 84, 158, 0.1);
    color: var(--button-background, #25549e);
}

.cs-cal-title {
    font-weight: 700;
    color: var(--text-color, #1e293b);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.15s;
}

.cs-cal-title:hover {
    background: rgba(37, 84, 158, 0.05);
}

/* Body / Views */
.cs-cal-body {
    min-height: 130px;
    position: relative;
}

/* Days View */
.cs-cal-view-days .cs-cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 2px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cs-cal-view-days .cs-cal-sun-header { color: #ef4444; }
.cs-cal-view-days .cs-cal-sat-header { color: #3b82f6; }

.cs-cal-view-days .cs-cal-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
}

.cs-cal-day {
    text-align: center;
    padding: 2px 0;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.8rem;
    color: var(--text-color, #1e293b);
    transition: background 0.15s, color 0.15s;
}

.cs-cal-day.cs-cal-sunday { color: #ef4444; font-weight: 600; }
.cs-cal-day.cs-cal-saturday { color: #3b82f6; font-weight: 600; }

.cs-cal-day:hover {
    background: rgba(37, 84, 158, 0.1);
    color: var(--button-background, #25549e);
}

.cs-cal-day.selected {
    background: var(--button-background, #25549e);
    color: #ffffff !important;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(37, 84, 158, 0.3);
}

.cs-cal-day.today {
    border: 2px solid var(--secondary-color, #ff5c0a);
    font-weight: 700;
}

.cs-cal-day.empty { cursor: default; }
.cs-cal-day.empty:hover { background: none; }

/* Months & Years View */
.cs-cal-view-months,
.cs-cal-view-years,
.cs-cal-view-acad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
    height: 100%;
    align-content: center;
}
.cs-cal-view-years {
    grid-template-columns: repeat(4, 1fr);
}
.cs-cal-view-acad {
    grid-template-columns: repeat(2, 1fr);
}

.cs-cal-grid-item {
    text-align: center;
    padding: 4px 2px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-color, #1e293b);
    background: var(--bg-color, #f8fafc);
    border: 1px solid #e2e8f0;
    transition: all 0.15s ease;
}

.cs-cal-grid-item:hover {
    background: rgba(37, 84, 158, 0.05);
    border-color: var(--button-background, #25549e);
    color: var(--button-background, #25549e);
}

.cs-cal-grid-item.selected {
    background: var(--button-background, #25549e);
    border-color: var(--button-background, #25549e);
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(37, 84, 158, 0.3);
}

/* Title resizing for time mode to ensure 1 row */
.cs-time-mode .cs-cal-title {
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

/* Time Picker View */
.cs-cal-view-time {
    display: flex;
    flex-direction: column;
    padding: 0;
}
.cs-spinners-container {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin-bottom: 6px;
    padding: 4px;
}
.cs-spinner-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 45px;
}
.cs-spin-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: #64748b;
    margin-bottom: 2px;
}
.cs-spin-btn {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.15s;
    line-height: 1;
}
.cs-spin-btn:hover {
    background: #e2e8f0;
    color: var(--button-background, #25549e);
}
.cs-spin-val {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
    margin: 2px 0;
    width: 100%;
    text-align: center;
}
.cs-spin-sep {
    font-size: 1.2rem;
    font-weight: 700;
    color: #94a3b8;
    margin: 0 4px;
    padding-top: 14px;
}


/* Footer (Today / Clear) */
.cs-cal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid #e2e8f0;
    padding-top: 8px;
    margin-top: 4px;
}

.cs-cal-footer button {
    background: none;
    border: none;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s;
}

.cs-cal-btn-today {
    color: var(--button-background, #25549e);
}
.cs-cal-btn-today:hover {
    background: rgba(37, 84, 158, 0.1);
}

.cs-cal-btn-clear {
    color: #ef4444;
}
.cs-cal-btn-clear:hover {
    background: rgba(239, 68, 68, 0.1);
}
