/* NexVolt BuiltBuilder - Classic Desktop Interface */

:root {
    --accent: #0066cc;
    --accent-dark: #004499;
    --background: #f0f0f0;
    --surface: #ffffff;
    --text-dark: #333333;
    --text-muted: #666666;
    --border-color: #cccccc;
    --success: #228B22;
    --warning: #cc8800;
    --error: #cc0000;
    --header-bg: #003366;
}

* {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
}

/* Ensure hidden attribute works everywhere */
[hidden] {
    display: none !important;
}

/* FOUC prevention: body stays hidden until CSS is parsed */
body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
    font-size: 13px;
    background: var(--background);
    color: var(--text-dark);
    animation: pageReveal 0s 50ms both;
}

@keyframes pageReveal {
    from { visibility: hidden; }
    to   { visibility: visible; }
}

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========== HEADER ========== */
header {
    padding: 10px 20px;
    background: var(--header-bg);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 3px solid #0066cc;
}

.header-content {
    flex: 1;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hub-link {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    text-decoration: none;
}

.hub-link:hover {
    background: rgba(255, 255, 255, 0.2);
}

.hub-link .material-symbols-outlined {
    font-size: 20px;
}

.brand-divider {
    width: 1px;
    height: 32px;
    background: rgba(255, 255, 255, 0.3);
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-brand .app-icon {
    font-size: 24px;
    color: #66b3ff;
}

.app-titles h1 {
    margin: 0;
    font-size: 16px;
    font-weight: bold;
}

.app-titles p {
    margin: 2px 0 0;
    color: #99ccff;
    font-size: 11px;
}

header h1 {
    margin: 0;
    font-size: 16px;
    font-weight: bold;
}

header p {
    margin: 2px 0 0;
    color: #99ccff;
    font-size: 11px;
}

/* User Menu in Header */
.header-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-menu {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding: 4px 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.user-name {
    font-size: 12px;
    font-weight: bold;
    color: #fff;
}

.user-role {
    font-size: 10px;
    color: #99ccff;
    text-transform: uppercase;
}

.logout-btn, .login-btn, .settings-btn, .admin-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: #ffffff;
    border: 1px solid #999999;
    color: #333333;
    text-decoration: none;
    cursor: pointer;
}

.logout-btn:hover, .settings-btn:hover, .admin-btn:hover {
    background: #e0e0e0;
}

.logout-btn { color: #cc0000; }
.settings-btn { color: #666666; }
.admin-btn { color: #cc8800; }

.login-btn {
    width: auto;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: bold;
}

.logout-btn .material-symbols-outlined,
.settings-btn .material-symbols-outlined,
.admin-btn .material-symbols-outlined {
    font-size: 18px;
}

/* ========== MAIN ========== */
main {
    flex: 1;
    padding: 16px;
}

/* ========== TOP NAVIGATION ========== */
nav.top-nav {
    background: #e8e8e8;
    border-bottom: 1px solid var(--border-color);
    padding: 0 16px;
    display: flex;
    gap: 0;
}

nav.top-nav a {
    text-decoration: none;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: bold;
    color: var(--text-dark);
    border-bottom: 3px solid transparent;
}

nav.top-nav a:hover {
    background: #d8d8d8;
}

nav.top-nav a.active {
    background: #ffffff;
    border-bottom-color: var(--accent);
    color: var(--accent);
}

nav.top-nav .material-symbols-outlined {
    font-size: 18px;
}

/* ========== BOTTOM NAV (hidden) ========== */
nav.bottom-nav {
    display: none;
}

/* ========== FIELDSETS / FORM GROUPS ========== */
.form-card, fieldset {
    background: var(--surface);
    border: 1px solid var(--border-color);
    margin-bottom: 16px;
    padding: 0;
}

.card-header, legend {
    background: linear-gradient(to bottom, #f8f8f8, #e8e8e8);
    border-bottom: 1px solid var(--border-color);
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: bold;
    font-size: 12px;
    color: var(--text-dark);
}

.card-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-icon .material-symbols-outlined {
    font-size: 18px;
    color: var(--accent);
}

.card-title h3 {
    margin: 0;
    font-size: 12px;
    font-weight: bold;
}

.card-title p {
    margin: 2px 0 0;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: normal;
}

.card-body {
    padding: 12px;
}

.card-body.no-padding {
    padding: 0;
}

/* ========== FORM ELEMENTS ========== */
.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: bold;
    color: var(--text-dark);
    margin-bottom: 4px;
}

.form-group label .material-symbols-outlined {
    display: none;
}

.select-wrapper {
    position: relative;
}

.select-wrapper select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    background: var(--surface);
    font-size: 12px;
    color: var(--text-dark);
    appearance: auto;
    -webkit-appearance: auto;
    -moz-appearance: auto;
}

.select-wrapper select option,
select option {
    background: #fff;
    color: var(--text-dark);
    padding: 4px 8px;
}

.select-wrapper select:focus {
    outline: none;
    border-color: var(--accent);
}

.select-arrow {
    display: none;
}

.text-input, .date-input, input[type="text"], input[type="email"], input[type="password"], input[type="number"] {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-dark);
    background: var(--surface);
}

.text-input:focus, .date-input:focus, input:focus {
    outline: none;
    border-color: var(--accent);
}

.input-hint {
    margin: 4px 0 0;
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

@media (max-width: 600px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }
}

/* ========== BUTTONS ========== */
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 16px;
    border: 1px solid var(--border-color);
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    background: linear-gradient(to bottom, #f8f8f8, #e0e0e0);
}

.action-btn:hover {
    background: linear-gradient(to bottom, #e8e8e8, #d0d0d0);
}

.action-btn:active {
    background: linear-gradient(to bottom, #d0d0d0, #e0e0e0);
}

.action-btn.primary {
    background: linear-gradient(to bottom, #0077dd, #0055aa);
    border-color: #004499;
    color: #fff;
}

.action-btn.primary:hover {
    background: linear-gradient(to bottom, #0066cc, #004499);
}

.action-btn.primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.action-btn.secondary {
    background: linear-gradient(to bottom, #f8f8f8, #e0e0e0);
    color: var(--text-dark);
}

.action-btn.outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-dark);
}

.action-btn.outline:hover {
    background: #f0f0f0;
    border-color: var(--accent);
}

.action-btn.small {
    padding: 4px 10px;
    font-size: 11px;
}

.action-btn.small .material-symbols-outlined {
    font-size: 14px;
}

.action-btn .material-symbols-outlined {
    font-size: 16px;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: transparent;
    border: 1px solid transparent;
    color: var(--accent);
    cursor: pointer;
}

.btn-icon:hover {
    background: #e0e0e0;
    border-color: var(--border-color);
}

/* ========== TABLES ========== */
.table-wrapper {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.data-table th,
.data-table td {
    padding: 6px 10px;
    text-align: left;
    border: 1px solid var(--border-color);
}

.data-table th {
    background: linear-gradient(to bottom, #f0f0f0, #e0e0e0);
    font-weight: bold;
    color: var(--text-dark);
}

.data-table tbody tr:nth-child(even) {
    background: #f8f8f8;
}

.data-table tbody tr:hover {
    background: #e8f4ff;
}

.data-table .text-center {
    text-align: center;
}

.table-empty {
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
}

.table-empty .material-symbols-outlined {
    font-size: 32px;
    opacity: 0.4;
    display: block;
    margin-bottom: 8px;
}

.table-empty p {
    margin: 0;
}

/* ========== BADGES ========== */
.badge {
    display: inline-block;
    padding: 2px 8px;
    font-size: 10px;
    font-weight: bold;
    background: #e0e0e0;
    border: 1px solid #cccccc;
    color: var(--text-muted);
}

.badge.success {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
}

.badge.warning {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.badge.error {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

/* ========== UPLOAD AREA ========== */
.upload-dropzone {
    border: 2px dashed #999999;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    background: #fafafa;
    margin-top: 12px;
}

.upload-dropzone:hover {
    border-color: var(--accent);
    background: #f0f8ff;
}

.upload-dropzone input[type="file"] {
    display: none;
}

.upload-icon {
    font-size: 32px;
    color: #999999;
}

.upload-text {
    font-weight: bold;
    margin: 8px 0 0;
}

.upload-subtext {
    font-size: 11px;
    color: var(--text-muted);
    margin: 4px 0 0;
}

/* ========== MATERIAL ICONS ========== */
.material-symbols-outlined {
    font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
    font-size: 18px;
}

/* ========== PAGE TITLE ========== */
.page-title {
    background: linear-gradient(to bottom, #f8f8f8, #e8e8e8);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-title .material-symbols-outlined {
    font-size: 24px;
    color: var(--accent);
}

.page-title h2 {
    margin: 0;
    font-size: 16px;
    font-weight: bold;
}

.page-title p {
    margin: 2px 0 0;
    font-size: 11px;
    color: var(--text-muted);
}

/* ========== TOAST NOTIFICATIONS ========== */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: #28a745;
    color: #fff;
    font-size: 13px;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 2000;
}

.toast.error {
    background: #dc3545;
}

.toast.warning {
    background: #ffc107;
    color: #333;
}

.toast-icon {
    font-size: 20px;
}

/* ========== MODALS ========== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    position: relative;
    width: 480px;
    max-width: 90%;
    background: var(--surface);
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.modal-content.small {
    width: 320px;
}

.modal-content.large {
    width: 720px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(to bottom, #f8f8f8, #e8e8e8);
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: bold;
}

.modal-close {
    width: 28px;
    height: 28px;
    background: transparent;
    border: 1px solid var(--border-color);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.modal-close:hover {
    background: #dc3545;
    border-color: #dc3545;
    color: #fff;
}

.modal-body {
    padding: 16px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 16px;
    background: #f8f8f8;
    border-top: 1px solid var(--border-color);
}
