/* =========================================
   COMPONENTES REUTILIZABLES (ÁTOMOS)
   ========================================= */

/* Icon Buttons */
.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.05);
    color: #cbd5e1;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    transform: scale(1.05);
    border-color: rgba(255, 255, 255, 0.2);
}

.icon-btn.active {
    background: #0ea5e9;
    color: white;
    border-color: #22d3ee;
}

/* Generic Buttons */
.btn {
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}

.btn-primary { background: #0ea5e9; color: white; }
.btn-primary:hover { background: #0284c7; }

.btn-success { background: #10b981; color: white; }
.btn-success:hover { background: #059669; }

.btn-danger { background: #ef4444; color: white; }
.btn-danger:hover { background: #dc2626; }

/* Ghost Buttons */
.btn-ghost {
    background: transparent;
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-small {
    padding: 4px 8px;
    font-size: 0.75rem;
}

/* Avatar Styles */
.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #334155;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-weight: 600;
    font-size: 0.9rem;
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}

.avatar-circle img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-circle:hover {
    border-color: var(--primary);
}

/* Dropdowns */
.user-menu-wrapper {
    position: relative;
}

.user-dropdown {
    position: absolute;
    top: 50px;
    right: 0;
    width: 240px;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    padding: 10px;
    z-index: 3000;
}

/* Sidebar fix */
.layout-sidebar .user-dropdown {
    top: 0;
    left: 100%; 
    right: auto;
    margin-left: 15px;
}

.dropdown-header {
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 5px;
    text-align: center;
}

.dropdown-header h4 {
    margin: 0;
    font-size: 0.95rem;
    color: white;
}

.dropdown-header p {
    margin: 4px 0 0;
    font-size: 0.8rem;
    color: #94a3b8;
}

.dropdown-item {
    width: 100%;
    text-align: left;
    padding: 10px;
    background: transparent;
    color: #cbd5e1;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
}

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

.dropdown-item.text-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

.dropdown-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 5px 0;
}

/* =========================================
   OVERLAY & DRAWERS
   ========================================= */
.drawer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 2999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.drawer-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.login-drawer,
.config-drawer {
    position: fixed;
    top: 0;
    width: 420px;
    height: 100vh;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(20px);
    z-index: 3000;
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
}

.login-drawer {
    right: -420px;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.config-drawer {
    left: -420px;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.login-drawer.open {
    transform: translateX(-420px);
}

.config-drawer.open {
    transform: translateX(420px);
}

.drawer-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
}

.drawer-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #f8fafc;
}

.drawer-content {
    flex: 1;
    padding: 0;
    overflow-y: auto;
}

/* Console Drawer */
#consoleDrawer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 200px;
    background: #0f172a;
    border-top: 1px solid #0ea5e9;
    z-index: 10000;
    transform: translateY(100%);
    transition: transform 0.3s;
    display: flex;
    flex-direction: column;
    font-family: monospace;
    font-size: 0.8rem;
}

#consoleDrawer.open {
    transform: translateY(0);
}

.console-header {
    padding: 8px 15px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-console {
    cursor: pointer;
    font-size: 0.9rem;
}

#consoleContent {
    flex: 1;
    overflow-y: auto;
    padding: 5px;
}

.console-line {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 2px 10px;
    font-size: 0.8rem;
}

/* Config Tabs */
.config-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    overflow-x: auto;
    padding: 0 10px;
}

.config-tab-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    padding: 15px 15px;
    cursor: pointer;
    font-size: 0.85rem;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.config-tab-btn:hover {
    color: white;
}

.config-tab-btn.active {
    color: #0ea5e9;
    border-bottom-color: #0ea5e9;
    font-weight: 600;
}

.config-tab-content {
    display: none;
    padding: 20px;
    animation: fadeIn 0.3s;
}

.config-tab-content.active {
    display: block;
}

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

/* Asset Uploader */
.asset-uploader {
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    transition: border-color 0.2s;
}

.asset-uploader:hover {
    border-color: #0ea5e9;
}

.asset-preview {
    width: 50px;
    height: 50px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.asset-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.asset-info {
    flex: 1;
}

.asset-label {
    display: block;
    font-size: 0.8rem;
    color: #cbd5e1;
    margin-bottom: 4px;
}

/* Config Actions */
.config-actions {
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

/* =========================================
   LOGIN MODERNO (ENTERPRISE)
   ========================================= */
.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.login-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.login-form label {
    font-size: 0.9rem;
    color: #94a3b8;
    margin-left: 5px;
}

.login-form .input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.login-form .input-wrapper i.bi {
    position: absolute;
    left: 15px;
    color: #64748b;
    font-size: 1.1rem;
}

.login-form input {
    width: 100%;
    padding: 12px 12px 12px 45px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    transition: all 0.3s;
}

.login-form input:focus {
    border-color: #0ea5e9;
    background: rgba(255,255,255,0.1);
    outline: none;
}

.eye-btn {
    position: absolute;
    right: 15px;
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
}

.btn-login-action {
    background: linear-gradient(135deg, #0ea5e9, #3b82f6);
    color: white;
    border: none;
    padding: 15px;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.2s;
}

.btn-login-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(14, 165, 233, 0.3);
}

.recents-section {
    margin-top: 30px;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 20px;
}

.recents-title {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 10px;
    text-align: center;
}

.recents-list {
    display: flex;
    justify-content: center;
    gap: 15px;
}

.recent-user-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    width: 60px;
}

.recent-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #334155;
    background-size: cover;
    border: 2px solid rgba(255,255,255,0.1);
    margin-bottom: 5px;
    transition: all 0.2s;
}

.recent-user-item:hover .recent-avatar {
    border-color: #0ea5e9;
    transform: scale(1.1);
}

.recent-user-item span {
    font-size: 0.7rem;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-align: center;
}

.login-footer {
    text-align: center;
    font-size: 0.9rem;
    color: #94a3b8;
    margin-top: 20px;
}

.login-footer a {
    color: #0ea5e9;
    text-decoration: none;
    font-weight: 500;
}

/* =========================================
   ESTILOS DE DOCUMENTO (PAPEL FÍSICO)
   ========================================= */
.doc-page {
    /* Física del papel */
    background-color: white !important;
    color: black !important;
    width: 21.59cm;
    height: 27.94cm;
    margin: 20px auto;
    
    /* El padding se controla ahora via JS para ser dinámico */
    /* padding: 0cm; */ 
    
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-family: 'Roboto Condensed', sans-serif !important;
}

/* Landscape / Récipe */
.doc-page.land {
    width: 27.94cm;
    height: 21.59cm;
}

/* El contenido interno se estila via documents.js, pero mantenemos resets */
.doc-header img, .doc-footer img {
    max-width: 100%;
    display: block;
    margin: 0 auto;
}
