/**
 * HEXFLIP Design System — Central component definitions
 * Loaded AFTER Bootstrap to override its defaults.
 * All HEXFLIP UI elements use these classes.
 */

/* === FORM CONTROLS === */
.form-control {
    width: 100%;
    background: var(--bg) !important;
    border: 1px solid var(--border) !important;
    border-radius: 0 !important;
    color: var(--text) !important;
    font-family: 'JetBrains Mono', monospace !important;
    font-size: 14px;
    padding: 12px 16px !important;
    margin-bottom: 16px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-shadow: none !important;
}
.form-control:focus {
    border-color: var(--yellow) !important;
    box-shadow: 0 0 12px var(--yellow-glow) !important;
    background: var(--bg) !important;
    color: var(--text) !important;
    outline: none;
}
.form-control::placeholder { color: var(--text-muted); }
textarea.form-control { min-height: 120px; resize: vertical; line-height: 1.6; }
select.form-control {
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236a6a7a'%3E%3Cpath d='M2 4l4 4 4-4z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 16px center !important;
    padding-right: 40px !important;
}

/* === HEADER (shared by admin + dashboard) === */
.header-bar {
    height: var(--header-height);
    background: var(--pink);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; flex-shrink: 0;
    box-shadow: 0 4px 20px var(--pink-glow);
    position: relative; z-index: 10;
}
.header-bar::after {
    content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
    background: linear-gradient(90deg, var(--teal), var(--teal-dark), var(--teal));
    opacity: 0.8;
}
.header-left { display: flex; align-items: center; gap: 20px; }
.header-logo {
    font-family: 'Orbitron', sans-serif; font-size: 16px; font-weight: 900;
    letter-spacing: 4px; color: var(--text-light); text-decoration: none;
}
.header-logo .dot { color: rgba(255,255,255,0.4); font-weight: 400; }
.header-title { font-family: 'JetBrains Mono', monospace; font-size: 14px; color: rgba(255,255,255,0.85); }
.header-title .arrow { color: rgba(255,255,255,0.5); margin: 0 4px; }
.header-title .current { color: var(--text-light); font-weight: 700; }
.header-right { display: flex; align-items: center; gap: 16px; position: relative; }
.header-user { display: flex; align-items: center; gap: 12px; cursor: pointer; transition: opacity 0.12s; }
.header-user:hover { opacity: 0.85; }
.header-username { font-family: 'JetBrains Mono', monospace; font-size: 13px; color: rgba(255,255,255,0.85); }
.header-avatar {
    width: 36px; height: 36px; border: 1.5px solid rgba(255,255,255,0.5);
    background: rgba(255,255,255,0.1);
    clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 6px, 100% 100%, 6px 100%, 0 calc(100% - 6px));
    transition: border-color 0.15s;
}
.header-user:hover .header-avatar { border-color: var(--yellow); }

/* === USER DROPDOWN (shared) === */
.user-dropdown {
    position: absolute; top: calc(100% + 8px); right: 0; min-width: 200px;
    background: var(--bg-card); border: 1px solid var(--border); z-index: 10000;
    clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}
.user-dropdown-header {
    padding: 16px 20px; font-family: 'JetBrains Mono', monospace; font-size: 12px;
    color: var(--teal); border-bottom: 1px solid var(--hairline);
    display: flex; align-items: center; gap: 10px;
}
.user-dropdown-header i { font-size: 18px; }
.user-dropdown-item {
    width: 100%; background: transparent; border: none; color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace; font-size: 12px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px; padding: 14px 20px; cursor: pointer;
    display: flex; align-items: center; gap: 10px; transition: all 0.12s; text-decoration: none;
}
.user-dropdown-item:hover { background: rgba(255,214,0,0.08); color: var(--yellow); }
.user-dropdown-item i { font-size: 15px; }

/* === STATS (shared) === */
.stats-card { padding: 24px 32px; }
.stats-row { display: flex; justify-content: space-around; align-items: center; gap: 16px; position: relative; z-index: 1; }
.stat-item { text-align: center; flex: 1; cursor: pointer; transition: transform 0.15s; padding: 8px 12px; border-left: 1px solid var(--border); }
.stat-item:first-child { border-left: none; }
.stat-item:hover { transform: translateY(-3px); }
.stat-value { font-family: 'Inter', sans-serif; font-size: 36px; font-weight: 600; line-height: 1; color: var(--text-light); transition: color 0.12s; }
.stat-caption { font-family: 'JetBrains Mono', monospace; font-size: 9px; text-transform: uppercase; letter-spacing: 1px; margin-top: 6px; color: var(--text-light); transition: color 0.12s; }
.stat-item:hover .stat-value, .stat-item:hover .stat-caption { color: var(--yellow); }
.stat-underline { width: 40px; height: 2px; margin: 6px auto 0; transition: width 0.2s, box-shadow 0.2s; }
.stat-item:hover .stat-underline { width: 70px; box-shadow: 0 0 10px var(--amber-glow); }
.underline-green { background: var(--green); }
.underline-orange { background: var(--orange); }
.underline-red { background: var(--red); }
.underline-teal { background: var(--teal); }

/* === MAIN CONTENT (shared) === */
.content-area {
    flex: 1; background: var(--bg); padding: 32px 48px; overflow-y: auto;
    display: flex; flex-direction: column; gap: 24px;
}
.main-centered {
    position: relative; z-index: 2; max-width: 1080px; margin: 0 auto; padding: 32px 24px 100px;
}

/* === SETTINGS FORM (admin settings) === */
.settings-form { display: flex; flex-direction: column; gap: 16px; position: relative; z-index: 1; padding: 0 32px 24px; }
.settings-form input, .settings-form textarea { width: 100%; background: var(--bg); border: 1px solid var(--border); color: var(--text); font-family: 'JetBrains Mono', monospace; font-size: 13px; padding: 10px 14px; outline: none; box-sizing: border-box; }
.settings-form input:focus, .settings-form textarea:focus { border-color: var(--yellow); box-shadow: 0 0 8px var(--yellow-glow); }
.settings-form textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.settings-form .checkbox-row { display: flex; align-items: center; gap: 10px; }
.settings-form .checkbox-row input { width: auto; }
.settings-section-title { font-family: 'JetBrains Mono', monospace; font-size: 12px; text-transform: uppercase; letter-spacing: 2px; font-weight: 700; color: var(--teal); margin-top: 24px; margin-bottom: 4px; padding-bottom: 8px; border-bottom: 1px solid var(--hairline); }
.settings-placeholder-list { font-family: 'JetBrains Mono', monospace; font-size: 10px; color: var(--text-muted); padding: 12px; background: var(--bg); border: 1px solid var(--hairline); margin-top: 8px; line-height: 1.8; }
.settings-placeholder-list code { color: var(--teal); }

/* === DELETE BUTTON: hold-to-confirm === */
.btn-table.danger { position: relative; overflow: hidden; }
.btn-table.danger .hold-fill { position: absolute; top: 0; left: 0; bottom: 0; width: 0%; background: var(--red); opacity: 0.25; transition: none; pointer-events: none; }
.btn-table.danger.holding .hold-fill { width: 100%; transition: width 0.8s linear; opacity: 0.4; }
.btn-table.danger.holding { color: var(--red); border-color: var(--red); box-shadow: 0 0 12px rgba(255,61,92,0.3); }
.btn-table.danger > * { position: relative; z-index: 1; }

/* === CONFIRM POPUP === */
.confirm-popup { position: absolute; z-index: 10000; background: var(--bg-card); border: 1px solid var(--red); box-shadow: 0 8px 30px rgba(0,0,0,0.5), 0 0 20px rgba(255,61,92,0.15); padding: 16px 20px; min-width: 220px; clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px)); font-family: 'JetBrains Mono', monospace; }
.confirm-popup::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--red); }
.confirm-popup-text { font-size: 12px; color: var(--text); margin-bottom: 12px; line-height: 1.5; }
.confirm-popup-actions { display: flex; gap: 8px; }
.confirm-popup-btn { flex: 1; font-family: 'JetBrains Mono', monospace; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; padding: 8px 12px; cursor: pointer; border: 1px solid; clip-path: polygon(0 0, calc(100% - 5px) 0, 100% 5px, 100% 100%, 5px 100%, 0 calc(100% - 5px)); transition: all 0.15s; }
.confirm-popup-yes { background: var(--bg); color: var(--red); border-color: var(--red); }
.confirm-popup-yes:hover { background: var(--red); color: var(--bg); box-shadow: 0 0 12px rgba(255,61,92,0.3); }
.confirm-popup-no { background: transparent; color: var(--text-muted); border-color: var(--border); }
.confirm-popup-no:hover { color: var(--text); border-color: var(--text-muted); }

/* === MISC === */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; }

/* Custom scrollbar (yellow hover) */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); transition: background 0.15s; }
::-webkit-scrollbar-thumb:hover { background: var(--yellow); box-shadow: 0 0 8px var(--yellow-glow); }
* { scrollbar-width: thin; scrollbar-color: var(--border) var(--bg); }
*:hover { scrollbar-color: var(--yellow) var(--bg); }

.scroll-progress-track {
    height: 3px;
    background: var(--border);
    margin-bottom: 20px;
    overflow: hidden;
    clip-path: polygon(0 0, calc(100% - 3px) 0, 100% 3px, 100% 100%, 0 100%);
}
.scroll-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--yellow);
    box-shadow: 0 0 6px var(--yellow-glow);
    transition: width 0.05s linear;
}
.modal-scroll-area {
    max-height: 60vh;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.modal-scroll-area::-webkit-scrollbar { display: none; }
input[type="checkbox"] {
    accent-color: var(--yellow);
    width: 18px; height: 18px; cursor: pointer;
}

/* === PASSWORD FIELD WITH VISIBILITY TOGGLE === */
.password-field-wrapper { position: relative; }
.password-field-wrapper input { padding-right: 40px; }
.password-toggle-btn {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; padding: 4px; font-size: 14px;
    transition: color 0.15s;
}
.password-toggle-btn:hover { color: var(--yellow); }

/* === HOLD-TO-DELETE (general, for any button) === */
.hold-delete { position: relative; overflow: hidden; }
.hold-delete .hold-fill { position: absolute; top: 0; left: 0; bottom: 0; width: 0%; background: var(--red); opacity: 0.25; transition: none; pointer-events: none; }
.hold-delete.holding .hold-fill { width: 100%; transition: width 0.8s linear; opacity: 0.4; }
.hold-delete.holding { color: var(--red); border-color: var(--red); box-shadow: 0 0 12px rgba(255,61,92,0.3); }
.hold-delete > * { position: relative; z-index: 1; }

/* === HOLD HINT (tooltip on quick click) === */
.hold-hint {
    background: var(--bg-card); border: 1px solid rgba(255,214,0,0.3); color: var(--yellow);
    font-family: 'JetBrains Mono', monospace; font-size: 9px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px; padding: 3px 8px;
    z-index: 10000;
    clip-path: polygon(0 0, calc(100% - 4px) 0, 100% 4px, 100% 100%, 4px 100%, 0 calc(100% - 4px));
    opacity: 0; transform: translateY(-4px);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
}
.hold-hint.visible { opacity: 1; transform: translateY(0); }

/* === PASSWORD GENERATOR BUTTONS === */
.pw-gen-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 6px 12px;
    cursor: pointer;
    transition: all 0.12s;
    clip-path: polygon(0 0, calc(100% - 4px) 0, 100% 4px, 100% 100%, 4px 100%, 0 calc(100% - 4px));
}
.pw-gen-btn:hover {
    color: var(--yellow);
    border-color: var(--yellow);
    box-shadow: 0 0 8px var(--yellow-glow);
}
.pw-gen-btn:active {
    background: rgba(255,214,0,0.1);
}

@media (max-width: 768px) {
    .header-bar { padding: 0 16px; }
    .header-logo { font-size: 12px; }
    .stats-row { flex-direction: column; }
    .stat-item { border-left: none; border-top: 1px solid var(--border); }
    .stat-item:first-child { border-top: none; }
}