/* FCDateAndOrTimeBox.css
   Styling for FCDateAndOrTimeBox — date, time, and datetime picker control.
   Follows FCControlsStyling.txt conventions exactly.
   All colors via var() from variables.css.
   Popup z-index: 19100 — above ASPxPopupControl (same rule as FCDateBox.css). */

/* -----------------------------------------------------------------------
   Container — flex row, matches FCTextBox / FCSpinEdit pattern exactly.
   position: relative is needed so the absolute popup anchors to it.
----------------------------------------------------------------------- */
.fcdatetimebox-container {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: var(--fccontrol-gap);
    position: relative;
}

/* -----------------------------------------------------------------------
   Mode width variants (Req 3 / styling spec).
   Width lives in CSS, not inline JS.
----------------------------------------------------------------------- */
/*.fcdatetimebox-container {
    --fcdatetimebox-control-width: 150px;
}

.fcdatetimebox--date {
    --fcdatetimebox-control-width: 130px;
}

.fcdatetimebox--time {
    --fcdatetimebox-control-width: 80px;
}

.fcdatetimebox--datetime {
    --fcdatetimebox-control-width: 150px;
}*/

/* -----------------------------------------------------------------------
   Input wrapper — holds the text input + icon button as a single flex unit.
----------------------------------------------------------------------- */
/*.fcdatetimebox-input-wrapper {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    position: relative;
    min-width: 0;
}*/
/* -----------------------------------------------------------------------
   Input wrapper — holds the text input + icon button as a single flex unit.
   Wrapper now owns the editable border/chrome, like FCDropDownList.
----------------------------------------------------------------------- */
.fcdatetimebox-input-wrapper {
    display: flex;
    align-items: center;
    flex: 0 0 var(--fcdatetimebox-control-width);
    width: var(--fcdatetimebox-control-width);
    max-width: 100%;
    position: relative;
    min-width: 0;
    box-sizing: border-box;
    border: var(--FCTextBox-border-default);
    border-radius: 2px;
    background: #fff;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

    .fcdatetimebox-input-wrapper:hover {
        border-color: rgba(90, 190, 91, 0.25);
    }

    .fcdatetimebox-input-wrapper:focus-within {
        border-color: rgb(90, 190, 91);
    }

.fcdatetimebox-input-wrapper--error {
    border-color: #cc0000 !important; /* Error border now belongs to wrapper */
}

/* -----------------------------------------------------------------------
   Text input — base
----------------------------------------------------------------------- */
.fcdatetimebox-input {
    box-sizing: border-box;
    border-radius: 2px;
    font-family: inherit;
    font-size: inherit;
    outline: none;
    height: 100%;
    width: 100%;
    padding: 0 28px 0 6px; /* right padding leaves room for icon */
    border: 0;
    background: transparent;
}

/* -----------------------------------------------------------------------
   Editable state
----------------------------------------------------------------------- */
.fcdatetimebox-input--editable {
/*    border: var(--FCTextBox-border-default);
    background: #fff;
*/
    color: inherit;
}

.fcdatetimebox-input--editable:hover {
    border-color: rgba(90, 190, 91, 0.25);
}

.fcdatetimebox-input--editable:focus {
    border-color: rgb(90, 190, 91);
}

/* -----------------------------------------------------------------------
   Error border state (Req 26)
----------------------------------------------------------------------- */
.fcdatetimebox-input--error {
    /*border-color: #cc0000 !important;*/ /* must win over hover/focus green */
    border-color: inherit;
}

/* -----------------------------------------------------------------------
   Read-only state (Req 15) — matches FCTextBox read-only exactly
----------------------------------------------------------------------- */
.fcdatetimebox-input--readonly {
    border: none;
    background: transparent;
    box-shadow: none;
    color: var(--FCTextBox-readonly-color);
    font-weight: bold;
    cursor: default;
    padding: 0 4px;
}

/* -----------------------------------------------------------------------
   Calendar icon button (Req 10)
----------------------------------------------------------------------- */
.fcdatetimebox-icon-btn {
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #555;
    border-radius: 2px;
    flex-shrink: 0;
}

    .fcdatetimebox-icon-btn:hover {
        color: rgb(90, 190, 91);
        background: var(--FCIconHoverBackGroundColor);
    }

/* -----------------------------------------------------------------------
   Error span — same pattern as FCTextBox (Req 26)
----------------------------------------------------------------------- */
.fcdatetimebox-error {
    display: none;
    white-space: nowrap;
    color: var(--FCTextBox-error-color);
    font-weight: var(--FCTextBox-error-font-weight);
    font-size: inherit;
    align-items: center;
    flex-shrink: 0;
    flex-grow: 0;
}

.fcdatetimebox-error--visible {
    display: inline-flex;
}

/* -----------------------------------------------------------------------
   FCGrid embedding.
   In a grid cell, the cell owns the width. Do not use standalone mode width,
   and do not let inline validation text consume cell layout space.
----------------------------------------------------------------------- */
.fcgrid-cell-editor-host.fcdatetimebox-container {
    width: 100%;
    height: 100%;
    min-width: 0;
}

    .fcgrid-cell-editor-host.fcdatetimebox-container .fcdatetimebox-input-wrapper {
        flex: 1 1 auto;
        width: 100%;
        min-width: 0;
    }

    .fcgrid-cell-editor-host.fcdatetimebox-container .fcdatetimebox-error--visible {
        display: none;
    }

/* Error icon — red circle with white ! (Req 26, matches FCTextBox) */
.fcdatetimebox-error-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    background-color: #cc0000;
    border-radius: 50%;
    background-image: url('data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 16 16%27%3E%3Ctext x=%276%27 y=%2713%27 font-size=%2713%27 font-weight=%27bold%27 fill=%27white%27%3E!%3C/text%3E%3C/svg%3E');
    background-repeat: no-repeat;
    background-size: contain;
    vertical-align: middle;
    margin-right: 3px;
    flex-shrink: 0;
}





/* -----------------------------------------------------------------------
   Popup (Req 11 / 31)
   position: absolute so it does not affect the flex flow of the container.
   z-index: 19100 — above ASPxPopupControl.
----------------------------------------------------------------------- */
.fcdatetimebox-popup {
    /*position: absolute;*/
    position: fixed;
    /*z-index: 19100;*/
    z-index: 19200;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
    padding: 10px;
    min-width: 320px; /* 300px calendar max-width + 2x 10px padding */
}

/* -----------------------------------------------------------------------
   Calendar container inside popup
----------------------------------------------------------------------- */
.fcdatetimebox-calendar-container {
    margin-bottom: 6px;
}

/* -----------------------------------------------------------------------
   Today / Clear buttons row (Req 33 / 34)
----------------------------------------------------------------------- */
.fcdatetimebox-date-actions {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
}

.fcdatetimebox-today-btn,
.fcdatetimebox-clear-btn {
    flex: 1 1 0;
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 2px;
    background: #f5f5f5;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
    text-align: center;
}

.fcdatetimebox-today-btn:hover,
.fcdatetimebox-clear-btn:hover {
    border-color: rgba(90, 190, 91, 0.6);
    background: rgba(90, 190, 91, 0.08);
}

/* -----------------------------------------------------------------------
   Time row (Req 11.6)
----------------------------------------------------------------------- */
.fcdatetimebox-time-row {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 6px;
}

.fcdatetimebox-time-input {
    box-sizing: border-box;
    width: 44px;
    padding: 3px 6px;
    border: var(--FCTextBox-border-default);
    border-radius: 2px;
    font-family: inherit;
    font-size: inherit;
    text-align: center;
}

.fcdatetimebox-time-input:focus {
    outline: none;
    border-color: rgb(90, 190, 91);
}

.fcdatetimebox-time-colon {
    font-weight: bold;
    color: #555;
    user-select: none;
}

/* -----------------------------------------------------------------------
   Time button area (Req 16) — empty by default, ready for preset buttons
----------------------------------------------------------------------- */
.fcdatetimebox-time-btn-area {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
    /* Empty when no preset buttons are added — takes no vertical space */
}

.fcdatetimebox-time-btn-area:empty {
    margin-bottom: 0;
}

/* -----------------------------------------------------------------------
   OK / Cancel actions row (Req 11.2)
----------------------------------------------------------------------- */
.fcdatetimebox-popup-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    margin-top: 2px;
}

.fcdatetimebox-ok-btn,
.fcdatetimebox-cancel-btn {
    padding: 4px 14px;
    border: 1px solid #ccc;
    border-radius: 2px;
    font-family: inherit;
    font-size: inherit;
    cursor: pointer;
}

.fcdatetimebox-ok-btn {
    background: rgb(90, 190, 91);
    color: #fff;
    border-color: rgb(90, 190, 91);
    font-weight: 600;
}

.fcdatetimebox-ok-btn:hover {
    background: rgb(70, 170, 71);
}

.fcdatetimebox-cancel-btn {
    background: #f5f5f5;
}

.fcdatetimebox-cancel-btn:hover {
    border-color: rgba(90, 190, 91, 0.6);
    background: rgba(90, 190, 91, 0.08);
}

/* -----------------------------------------------------------------------
   Mobile: full-screen modal popup (Req 13.1)
   CSS media query only — no JS branching.
----------------------------------------------------------------------- */
@media (max-width: 600px) {
    .fcdatetimebox-popup {
        position: fixed;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh;
        border-radius: 0;
        border: none;
        box-shadow: none;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        padding: 20px;
    }

    .fcdatetimebox-calendar-container {
        flex: 1 1 auto;
    }
}
