/* 
  PREMIUM HOLDED-INSPIRED DESIGN SYSTEM 
  Focus: Visual Excellence, Clarity, and Simplicity
*/

:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-soft: #f1f5f9;
    --bg-app: #f8fafc;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-soft: #f8fafc;

    /* Theme Soft Colors */
    --bg-blue-soft: #eff6ff;
    --bg-green-soft: #f0fdf4;
    --bg-red-soft: #fff1f2;
    --bg-amber-soft: #fef3c7;
    --bg-purple-soft: #fdf4ff;
    --bg-orange-soft: #ffedd5;

    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-tertiary: #94a3b8;
    --border: #e2e8f0;
    --border-soft: #f1f5f9;
    --error: #ef4444;
    --success: #10b981;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

.hidden {
    display: none !important;
}

/* Dark Theme Variables */
[data-theme="dark"] {
    --bg-app: #000000;
    --bg-sidebar: #09090b;
    /* Very dark gray for sidebar/cards */
    --bg-card: #09090b;
    --bg-soft: #0a0a0a;

    /* Theme Soft Colors - Dark Mode */
    --bg-blue-soft: rgba(59, 130, 246, 0.1);
    --bg-green-soft: rgba(34, 197, 94, 0.1);
    --bg-red-soft: rgba(239, 68, 68, 0.1);
    --bg-amber-soft: rgba(245, 158, 11, 0.1);
    --bg-purple-soft: rgba(168, 85, 247, 0.1);
    --bg-orange-soft: rgba(249, 115, 22, 0.1);

    --text-main: #f8fafc;
    /* Crisp white */
    --text-muted: #a1a1aa;
    /* Readable gray */
    --text-tertiary: #71717a;
    --border: #27272a;
    /* Subtle visible borders */
    --border-soft: #18181b;
    --primary-soft: rgba(37, 99, 235, 0.2);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text-main);
    background-color: var(--bg-app);
    line-height: 1.6;
}

/* Typography Enhancements */
h1 {
    font-size: 1.875rem;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--text-main);
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.025em;
}

h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
}

/* Buttons: Refined & Tactile */
.btn {
    padding: 10px 18px;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 15px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: white;
    color: var(--text-main);
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: var(--text-tertiary);
}

/* Cards: Premium Depth */
.card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

/* Form Inputs: Clean & Usable */
.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-main);
    letter-spacing: 0.01em;
}

.required-asterisk {
    color: #ef4444;
    margin-left: 2px;
    font-weight: 600;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 10px;
    border: 1px solid var(--border);
    font-size: 1rem;
    transition: all 0.2s;
    background: #ffffff;
    color: var(--text-main);
    line-height: 1.5;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
    background: #fdfdfd;
}

/* Smaller inputs for dense layouts */
.form-input-sm {
    padding: 8px 12px;
    height: 38px;
    font-size: 0.875rem;
}

/* Input with Icon/Suffix */
.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon .form-input,
.input-with-icon .form-input-sm {
    padding-right: 32px;
    /* Space for suffix */
    width: 100%;
}

.input-suffix {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.875rem;
    pointer-events: none;
    font-weight: 500;
}


/* Custom Checkbox style */
input[type="checkbox"] {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 2px solid var(--border);
    cursor: pointer;
    accent-color: var(--primary);
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-error {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #e0f2fe;
    color: #075985;
}

/* Modal Overlay: Blur effect */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-overlay.active,
.modal-overlay.open {
    display: flex !important;
}

.modal-card {
    background: white;
    padding: 32px;
    border-radius: 16px;
    width: 95%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    animation: modalEnter 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalEnter {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Toast Container (Enhanced) */
#toastContainer {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: white;
    border-left: 4px solid var(--primary);
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 12px;
    min-width: 320px;
    display: flex;
    align-items: center;
    gap: 16px;
    animation: toastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes toastIn {
    from {
        transform: translateX(100%) scale(0.9);
        opacity: 0;
    }

    to {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

/* Auth Layout (Centrado y Premium) */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 0% 0%, rgba(37, 99, 235, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 100% 100%, rgba(79, 70, 229, 0.05) 0%, transparent 50%),
        #f8fafc;
    padding: 24px;
}

.auth-card {
    background: #ffffff;
    padding: 48px;
    border-radius: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02),
        0 20px 25px -5px rgba(0, 0, 0, 0.05),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 440px;
    border: none;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation: authEnter 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authEnter {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-header {
    text-align: center;
    margin-bottom: 40px;
}

.auth-header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 12px;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* User Profile Card (Sidebar) */
.user-sidebar-card {
    margin: 16px;
    padding: 16px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s;
}

.user-sidebar-card:hover {
    background: #f1f5f9;
    border-color: var(--text-tertiary);
}

.avatar-initial {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.2);
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* User Profile - Header Version */
.user-header-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    position: relative;
    user-select: none;
}

.user-header-profile:hover {
    background: var(--primary-soft);
}

.user-header-profile.pillar-active {
    padding: 0;
}

.user-header-profile.pillar-active:hover {
    background: transparent;
}

.user-header-profile.pillar-active>div:hover {
    background: var(--primary-soft);
    border-radius: 12px;
}

.user-header-profile .avatar-initial {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 0.8rem;
}

.user-header-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    align-items: flex-end;
}

.user-header-name {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-main);
}

.user-header-role {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Header Dropdown Menu */
.header-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 200px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    padding: 8px;
    display: none;
    flex-direction: column;
    animation: dropdownEnter 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.header-dropdown-menu.active {
    display: flex;
}

@keyframes dropdownEnter {
    from {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.dropdown-item:hover {
    background: var(--primary-soft);
    color: var(--primary);
}

.dropdown-item i {
    width: 16px;
    color: inherit;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-soft);
    margin: 8px 4px;
}

.dropdown-item.logout {
    color: var(--error);
}

.dropdown-item.logout:hover {
    background: #fff1f2;
}

[data-theme="dark"] .header-dropdown-menu {
    background: #09090b;
    border-color: #27272a;
    backdrop-filter: blur(10px);
    background: rgba(9, 9, 11, 0.85);
}

/* Utilities */
.btn-block {
    width: 100%;
    display: flex;
}

.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 1.5rem;
}

.text-sm {
    font-size: 0.875rem;
}

.text-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.text-link:hover {
    text-decoration: underline;
}

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(37, 99, 235, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Premium Table Layout - Holded Style */
table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

th {
    text-align: left;
    padding: 16px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

td {
    padding: 16px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

tr:hover td {
    background: #f8fafc;
}

tr:last-child td {
    border-bottom: none;
}

/* Skeleton Loader */
.skeleton {
    background: linear-gradient(90deg, var(--border) 25%, var(--bg-app) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
    height: 1em;
    width: 100%;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

[data-theme="dark"] .card {
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.5);
}

[data-theme="dark"] .holded-table-card {
    background: var(--bg-card);
}

[data-theme="dark"] .holded-table th {
    background: #09090b !important;
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: #000000 !important;
    border-color: #27272a !important;
    color: white !important;
}

[data-theme="dark"] .modal-card {
    background: #09090b;
    border: 1px solid #27272a;
}

[data-theme="dark"] .category-card {
    background: #09090b;
    border-color: #27272a;
}

[data-theme="dark"] .badge-info {
    background: rgba(37, 99, 235, 0.2);
    color: #93c5fd;
}