/* core/controls.css
   Reusable Windows XP UI widgets — tabs, buttons, selects, dialog shell.
   These components are not tied to any single app; any dialog or panel
   can use them by applying the .xp-* class names. */

/* ------------------------------------------------------------------ */
/* Dialog shell                                                         */
/* ------------------------------------------------------------------ */
.xp-dialog {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #ece9d8;
    padding: 7px 8px 0 6px;
    box-sizing: border-box;
    font-family: 'Tahoma', sans-serif;
    font-size: 11px;
    user-select: none;
    -webkit-user-select: none;
}

/* ------------------------------------------------------------------ */
/* Tab strip                                                            */
/* ------------------------------------------------------------------ */
.xp-tabs {
    display: flex;
    align-items: flex-end;
    padding-left: 0;
    gap: 1px;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.xp-tab {
    padding: 2px 10px 2px;
    border: 1px solid #919b9c;
    border-radius: 3px 3px 0 0;
    background: #d4d0c8;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    margin-bottom: -1px;
    z-index: 0;
}

/* Orange top-edge highlight on hover (inactive tabs only) */
.xp-tab:not(.xp-tab-active):hover::before {
    content: '';
    position: absolute;
    top: -1px; left: -1px; right: -1px;
    height: 2px;
    border: 1px solid #e68b2c;
    border-bottom: none;
    background: #ffc73c;
    border-radius: 3px 3px 0 0;
    z-index: 1;
}

.xp-tab.xp-tab-disabled { color: #b9b5a8; cursor: default; }

.xp-tab.xp-tab-active {
    padding: 3px 10px 4px;
    border-top: 1px solid #919b9c;
    border-left: none;
    border-right: none;
    border-bottom: none;
    background: #fcfcfe;
    cursor: default;
    z-index: 2;
}

/* Extend left/right borders past the tab's own box to reach the body border */
.xp-tab.xp-tab-active::after {
    content: '';
    position: absolute;
    top: 0; left: -2px; right: -2px; bottom: 0;
    border-left: 1px solid #919b9c;
    border-right: 1px solid #919b9c;
    background: #fcfcfe;
    z-index: -1;
}
.xp-tab.xp-tab-active:first-child::after { left: 0; }
.xp-tab.xp-tab-active:last-child::after  { right: 0; }

/* Orange top-edge highlight on active tab */
.xp-tab.xp-tab-active::before {
    content: '';
    position: absolute;
    top: -1px; left: -2px; right: -2px;
    height: 2px;
    border: 1px solid #e68b2c;
    border-bottom: none;
    background: #ffc73c;
    border-radius: 3px 3px 0 0;
    z-index: 1;
}
.xp-tab.xp-tab-active:first-child::before { left: 0; }
.xp-tab.xp-tab-active:last-child::before  { right: 0; }

/* ------------------------------------------------------------------ */
/* Tabbed content area                                                  */
/* ------------------------------------------------------------------ */
.xp-dialog-body {
    flex: 1;
    background: #fcfcfe;
    border: 1px solid #919b9c;
    box-shadow: 1px 1px 0 #d0cebf, 2px 2px 0 #e3e0d0;
    position: relative;
    z-index: 0;
    overflow: hidden;
    min-height: 0;
}

.xp-dialog-panel {
    display: none;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
    padding: 8px 9px 6px;
}
.xp-dialog-panel.xp-dialog-panel-active { display: flex; }

/* ------------------------------------------------------------------ */
/* Bottom button bar (OK / Cancel / Apply row)                         */
/* ------------------------------------------------------------------ */
.xp-buttonbar {
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    flex-shrink: 0;
}

/* ------------------------------------------------------------------ */
/* XP-style push button                                                 */
/* ------------------------------------------------------------------ */
.xp-btn {
    min-width: 73px;
    padding: 3px 8px 4px;
    font-family: 'Tahoma', sans-serif;
    font-size: 11px;
    color: #000;
    border: 1px solid #003c74;
    border-radius: 3px;
    background: linear-gradient(to bottom, #f5f4ef, #e5e3db);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.9), inset 1px 0 0 rgba(255,255,255,0.5);
    cursor: pointer;
    text-align: center;
    white-space: nowrap;
}
.xp-btn:hover:not(:disabled)  { background: linear-gradient(to bottom, #f8f7f3, #ece9e0); border-color: #316ac5; }
.xp-btn:active:not(:disabled) { background: linear-gradient(to bottom, #d9d7cf, #e8e6de); box-shadow: inset 1px 1px 2px rgba(0,0,0,0.15); }
.xp-btn:disabled               { background: #f5f4ea; border-color: #c9c7ba; color: #c0bcb0; box-shadow: none; cursor: default; }

/* ------------------------------------------------------------------ */
/* Form helpers                                                         */
/* ------------------------------------------------------------------ */
.xp-field-label { display: block; margin-bottom: 2px; }
.xp-row         { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }

/* Native <select> styled to XP look */
.xp-select {
    font-family: 'Tahoma', sans-serif;
    font-size: 11px;
    border: 1px solid #7f9db9;
    background: #fff;
    height: 21px;
    cursor: pointer;
    box-sizing: border-box;
}

/* ------------------------------------------------------------------ */
/* Custom select widget (escapes overflow:hidden with a fixed dropdown) */
/* ------------------------------------------------------------------ */
.xp-cselect {
    display: flex;
    align-items: center;
    height: 21px;
    border: 1px solid #7f9db9;
    background: #fff;
    box-sizing: border-box;
    cursor: default;
    font-family: 'Tahoma', sans-serif;
    font-size: 11px;
    padding-left: 3px;
    user-select: none;
}
.xp-cselect-val { flex: 1; overflow: hidden; white-space: nowrap; }
.xp-cselect-arrow {
    width: 17px;
    height: 100%;
    flex-shrink: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='17' height='21'%3E%3Crect width='17' height='21' fill='%23dce6f5'/%3E%3Cpolygon points='4,8 13,8 8.5,14' fill='%23244f87'/%3E%3C/svg%3E") no-repeat center/100% 100%;
    border-left: 1px solid #7f9db9;
}
.xp-cselect-dropdown {
    position: fixed;
    background: #fff;
    border: 1px solid #7f9db9;
    box-shadow: 1px 2px 4px rgba(0,0,0,0.25);
    z-index: 999999;
    font-family: 'Tahoma', sans-serif;
    font-size: 11px;
}
.xp-cselect-item          { padding: 2px 5px; cursor: default; white-space: nowrap; }
.xp-cselect-item:hover    { background: #316ac5; color: #fff; }
.xp-cselect-item-sel      { background: #316ac5; color: #fff; }
