/*
 * Central Design System & Stylesheet
 * Gestoría G & SysFactory
 * Enterprise Professional Theme
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* --- Corporate Color Palette --- */
    --bg-primary: #f5f5f5;
    --bg-card: #ffffff;
    --bg-sidebar: #1a1a2e;
    --text-main: #2d2d2d;
    --text-muted: #6b7280;
    --text-light: #9ca3af;
    --primary: #1e3a5f;
    --primary-hover: #16304e;
    --accent: #2e7d6f;
    --accent-hover: #256b5f;
    --success: #2e7d6f;
    --error: #c0392b;
    --warning: #d4a017;
    --border-color: #e0e0e0;
    --border-focus: #1e3a5f;
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 64px;
    --transition-speed: 0.25s;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --header-height: 56px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;
}

/* --- Global Reset & Base --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-primary);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.55;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #c5c5c5;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* --- Utility Animations --- */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.animate-fade {
    animation: fadeIn 0.3s ease-out forwards;
}

.animate-slide {
    animation: slideUp 0.35s ease-out forwards;
}

/* ============================================
   AUTH PAGES (Login / NIP Verification)
   ============================================ */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #e8e8e8;
    padding: 20px;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    padding: 36px 32px;
    text-align: center;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background-color: var(--primary);
    color: #ffffff;
    font-size: 24px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.auth-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}

.auth-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 28px;
    font-weight: 400;
}

.form-group {
    margin-bottom: 18px;
    text-align: left;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.input-container {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 14px;
    pointer-events: none;
    transition: color 0.2s;
}

.form-input {
    width: 100%;
    padding: 10px 12px 10px 38px;
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--text-main);
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.form-input:focus + .input-icon {
    color: var(--primary);
}

.btn-primary {
    width: 100%;
    padding: 11px 20px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    background-color: var(--primary);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background-color 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-primary:active {
    background-color: #122a40;
}

.alert-message {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 20px;
    text-align: left;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.alert-error {
    background-color: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-success {
    background-color: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.auth-footer {
    margin-top: 28px;
    font-size: 11px;
    color: var(--text-light);
}

/* --- NIP Code View Components --- */
.nip-digits-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
}

.nip-digit-input {
    width: 46px;
    height: 50px;
    font-family: var(--font-sans);
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    color: var(--primary);
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.nip-digit-input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.nip-timer {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.nip-timer span {
    color: var(--error);
}

/* ============================================
   CONTAINER DASHBOARD LAYOUT
   ============================================ */
.dashboard-wrapper {
    min-height: 100vh;
    display: flex;
}

/* --- Sidebar --- */
.dashboard-sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: width var(--transition-speed) ease;
}

.sidebar-header {
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.sidebar-logo {
    width: 32px;
    height: 32px;
    background-color: var(--accent);
    color: #ffffff;
    font-size: 15px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.01em;
    white-space: nowrap;
    opacity: 1;
    transition: opacity var(--transition-speed);
}

.sidebar-subtitle {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.sidebar-profile {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background-color: var(--accent);
    color: #ffffff;
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.profile-details {
    display: flex;
    flex-direction: column;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-name {
    font-size: 13px;
    font-weight: 600;
}

.profile-role {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.45);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
}

.menu-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.25);
    padding: 8px 12px 6px;
    letter-spacing: 0.08em;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    margin-bottom: 2px;
    transition: all 0.15s ease;
    cursor: pointer;
}

.menu-item:hover {
    color: rgba(255, 255, 255, 0.85);
    background-color: rgba(255, 255, 255, 0.05);
}

.menu-item.active {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.08);
    font-weight: 600;
    border-left: 3px solid var(--accent);
    padding-left: 9px;
}

.menu-item i {
    font-size: 14px;
    width: 18px;
    text-align: center;
}

.sidebar-footer {
    padding: 14px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 12px;
    color: rgba(255, 255, 255, 0.5);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s ease;
    cursor: pointer;
}

.btn-logout:hover {
    color: var(--error);
    border-color: rgba(192, 57, 43, 0.4);
    background-color: rgba(192, 57, 43, 0.06);
}

/* --- Main Dashboard Panel --- */
.dashboard-main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-speed) ease;
}

.main-header {
    background-color: var(--bg-card);
    height: var(--header-height);
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.btn-toggle-sidebar {
    background: none;
    border: none;
    font-size: 16px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: background-color 0.15s;
}

.btn-toggle-sidebar:hover {
    background-color: var(--bg-primary);
}

.header-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-date {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-primary);
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.main-content {
    flex: 1;
    padding: 24px;
    background-color: var(--bg-primary);
}

/* --- Welcome Card --- */
.welcome-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    max-width: 560px;
    margin: 12px auto 0;
    text-align: center;
}

.welcome-icon {
    font-size: 36px;
    color: var(--accent);
    margin-bottom: 16px;
}

.welcome-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 8px;
}

.welcome-text {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
    max-width: 440px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

/* ============================================
   RESPONSIVE SIDEBAR COLLAPSING
   ============================================ */
.sidebar-collapsed .dashboard-sidebar {
    width: var(--sidebar-collapsed-width);
}

.sidebar-collapsed .sidebar-title,
.sidebar-collapsed .sidebar-subtitle,
.sidebar-collapsed .profile-details,
.sidebar-collapsed .menu-title,
.sidebar-collapsed .menu-item span,
.sidebar-collapsed .btn-logout span {
    display: none;
}

.sidebar-collapsed .sidebar-header,
.sidebar-collapsed .sidebar-profile {
    justify-content: center;
    padding: 18px 0;
}

.sidebar-collapsed .menu-item {
    justify-content: center;
    padding: 10px 0;
    border-left: none !important;
}

.sidebar-collapsed .dashboard-main {
    margin-left: var(--sidebar-collapsed-width);
}

/* ============================================
   CATALOG TABLE STYLES
   ============================================ */
.table-catalog {
    width: 100%;
    border-collapse: collapse;
}

.table-catalog th {
    font-size: 11px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    padding: 12px 16px;
    border-bottom: 2px solid var(--border-color);
    text-align: left;
}

.table-catalog td {
    padding: 12px 16px;
    vertical-align: middle;
    color: var(--text-main);
    font-size: 13px;
    border-bottom: 1px solid #f0f0f0;
}

.table-row-hover {
    transition: background-color 0.1s ease;
}

.table-row-hover:hover {
    background-color: #fafafa;
}

/* --- Action Buttons inside Tables --- */
.btn-table-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    width: auto;
    height: 32px;
    padding: 0 8px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 12px;
    white-space: nowrap;
}

.btn-table-action:hover {
    background-color: var(--bg-primary);
    border-color: #ccc;
}

.btn-table-action:active {
    background-color: #eee;
}

/* --- Loader Animation --- */
.module-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    color: var(--text-muted);
}

.module-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e0e0e0;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    margin-bottom: 10px;
}

/* ============================================
   BOOTSTRAP MODAL OVERRIDES (Professional)
   ============================================ */
.modal-content {
    border-radius: var(--radius-md) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--shadow-lg) !important;
    overflow: hidden;
}

.modal-header {
    background-color: var(--primary) !important;
    color: #fff !important;
    padding: 16px 20px !important;
    border-bottom: none !important;
}

.modal-header .modal-title {
    font-size: 15px !important;
    font-weight: 600 !important;
    font-family: var(--font-sans) !important;
}

.modal-body {
    padding: 20px !important;
    font-family: var(--font-sans) !important;
}

.modal-body .form-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.modal-body .form-input {
    padding: 9px 12px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

.modal-body select.form-input {
    padding: 9px 12px;
    font-size: 13px;
}

.modal-footer {
    padding: 12px 20px !important;
    border-top: 1px solid #f0f0f0 !important;
}

.modal-footer .btn-primary {
    width: auto;
    padding: 9px 20px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

.modal-footer .btn-secondary,
.modal-footer .btn {
    font-family: var(--font-sans);
    font-size: 13px;
    padding: 9px 16px;
    border-radius: var(--radius-sm) !important;
}

.modal-backdrop {
    z-index: 1040 !important;
}

.modal {
    z-index: 1050 !important;
}

