@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #5e52f1;
    --primary-hover: #4d43d1;
    --sidebar-bg: #0f172a;
    --bg-body: #f1f5f9;
    --white: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --radius: 20px;
    --shadow: 0 10px 25px -5px rgba(0,0,0,0.05);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; background: var(--bg-body); color: var(--text-main); min-height: 100vh; }

/* ================================
   LOGIN PAGE STYLES
================================ */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-box {
    background: var(--white);
    padding: 3rem;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.login-box .logo {
    margin-bottom: 1.5rem;
}

.login-box .logo i {
    font-size: 3rem;
    color: var(--primary);
}

.login-box h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.login-box .subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.login-box .form-group {
    margin-bottom: 1.5rem;
    text-align: left;
    position: relative;
}

.login-box .form-group label {
    display: block;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.login-box .form-group input {
    width: 100%;
    padding: 14px 50px 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
}

.login-box .form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(94, 82, 241, 0.1);
}

.login-box .form-group input::placeholder {
    color: #a0aec0;
}

.login-box .form-group .input-icon {
    position: absolute;
    right: 16px;
    top: 42px;
    color: var(--text-muted);
    font-size: 1rem;
}

.login-box .btn {
    width: 100%;
    padding: 14px 24px;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1rem;
    margin-top: 1rem;
}

.login-box .btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.login-box .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(102, 126, 234, 0.5);
}

.alert {
    padding: 14px 18px;
    border-radius: 14px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert i {
    font-size: 1.1rem;
}

.alert-danger {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #dcfce7;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.alert-info {
    background: #e0f2fe;
    color: #0369a1;
    border: 1px solid #bae6fd;
}

.alert-warning {
    background: #fef3c7;
    color: #d97706;
    border: 1px solid #fde68a;
}

/* ================================
   DASHBOARD LAYOUT
================================ */
.dashboard {
    display: flex;
    min-height: 100vh;
}

.layout { display: flex; min-height: 100vh; }

/* ================================
   SIDEBAR STYLES
================================ */
.sidebar {
    width: 280px;
    background: var(--sidebar-bg);
    color: white;
    padding: 1.5rem;
    position: fixed;
    height: 100vh;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-header {
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 1.5rem;
}

.sidebar-header h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.3rem;
    font-weight: 700;
}

.sidebar-header h2 i {
    color: var(--primary);
    font-size: 1.5rem;
}

.sidebar-brand { display: flex; align-items: center; gap: 10px; font-size: 1.3rem; font-weight: 800; padding-bottom: 2rem; }
.sidebar-brand i { color: var(--primary); }

.user-info {
    background: rgba(255,255,255,0.05);
    padding: 1.2rem;
    border-radius: 14px;
    margin-bottom: 1.5rem;
}

.user-name {
    font-weight: 600;
    font-size: 1rem;
    color: white;
}

.user-role {
    font-size: 0.85rem;
    color: #94a3b8;
    text-transform: capitalize;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 0.3rem;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.9rem 1.2rem;
    color: #94a3b8;
    text-decoration: none;
    border-radius: 14px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.sidebar-menu a:hover {
    background: rgba(255,255,255,0.05);
    color: white;
}

.sidebar-menu a.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 10px 15px -3px rgba(94, 82, 241, 0.3);
}

.sidebar-menu a i {
    width: 20px;
    text-align: center;
}

.menu-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 1rem 0;
}

.menu-list { list-style: none; margin-top: 1rem; }
.menu-link { 
    display: flex; align-items: center; gap: 12px; padding: 0.9rem 1.2rem; 
    color: #94a3b8; text-decoration: none; border-radius: 14px; transition: 0.3s;
    font-weight: 500; margin-bottom: 0.4rem;
}
.menu-link:hover { background: rgba(255,255,255,0.05); color: white; }
.menu-link.active { background: var(--primary); color: white; box-shadow: 0 10px 15px -3px rgba(94, 82, 241, 0.3); }

/* ================================
   MAIN CONTENT AREA
================================ */
.main-content {
    margin-left: 280px;
    flex: 1;
    padding: 2rem;
    width: calc(100% - 280px);
    min-height: 100vh;
    background: var(--bg-body);
}

.main { margin-left: 280px; flex: 1; padding: 2.5rem; width: calc(100% - 280px); }

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
}

.top-bar h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--text-main);
}

.content {
    padding: 0;
}

.header-welcome { 
    background: var(--white); padding: 2rem; border-radius: var(--radius); 
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

/* ================================
   STATS CARDS
================================ */
.stats-grid, .stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-box, .stat-card {
    background: var(--white);
    padding: 1.8rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.stat-icon.blue { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.stat-icon.green { background: linear-gradient(135deg, #22c55e, #16a34a); }
.stat-icon.purple { background: linear-gradient(135deg, #8b5cf6, #7c3aed); }
.stat-icon.orange { background: linear-gradient(135deg, #f97316, #ea580c); }

.stat-info h3 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-main);
}

.stat-info p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ================================
   CONTENT CARDS & TABLES
================================ */
.content-card, .card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 2rem;
}

.card-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #334155;
}

.card-body {
    padding: 1.5rem 2rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: #f8fafc;
    padding: 1rem 2rem;
    text-align: left;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

td {
    padding: 1.2rem 2rem;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.95rem;
    vertical-align: middle;
}

tr:hover {
    background: #f8fafc;
}

/* ================================
   BUTTONS
================================ */
.btn {
    padding: 0.7rem 1.4rem;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-family: 'Inter', sans-serif;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-success {
    background: #22c55e;
    color: white;
}

.btn-success:hover {
    background: #16a34a;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-secondary {
    background: #64748b;
    color: white;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

/* ================================
   BADGES
================================ */
.badge {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    display: inline-block;
}

.badge-active, .badge-success {
    background: #dcfce7;
    color: #15803d;
}

.badge-inactive, .badge-danger {
    background: #fee2e2;
    color: #dc2626;
}

.badge-pending, .badge-warning {
    background: #fef3c7;
    color: #d97706;
}

/* Status indicators */
.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.status-indicator.active {
    background: #22c55e;
}

.status-indicator.inactive {
    background: #ef4444;
}

/* ================================
   FORMS
================================ */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(94, 82, 241, 0.1);
}

/* ================================
   MODALS
================================ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: white;
    width: 95%;
    max-width: 500px;
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.modal-header h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-main);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-main);
}

/* ================================
   TOOLS GRID
================================ */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.tool-card {
    background: var(--white);
    border-radius: 16px;
    padding: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: none;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.tool-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px -15px rgba(94, 82, 241, 0.25);
}

.tool-card .icon {
    width: 100%;
    height: 8px;
    display: block;
    position: relative;
}

.tool-card .icon i {
    position: absolute;
    top: 15px;
    left: 20px;
    width: 48px;
    height: 48px;
    background: inherit;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
}

.tool-card h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-main);
    margin: 70px 20px 10px 20px;
    line-height: 1.4;
}

.tool-card p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0 20px 20px 20px;
    line-height: 1.6;
    flex-grow: 1;
}

/* Para pantallas grandes */
@media (max-width: 1400px) {
    .tools-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1100px) {
    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .tools-grid {
        grid-template-columns: 1fr;
    }
    
    .tool-card h4 {
        margin-top: 65px;
    }
}

/* ================================
   RESPONSIVE
================================ */

/* Botón toggle menú móvil */
.menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    width: 45px;
    height: 45px;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(94, 82, 241, 0.4);
    transition: all 0.3s ease;
}

.menu-toggle:hover {
    transform: scale(1.05);
}

/* Overlay para móvil */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}

/* Tablet - 1024px */
@media (max-width: 1024px) {
    .sidebar {
        width: 240px;
    }
    
    .main-content,
    .main {
        margin-left: 240px;
        width: calc(100% - 240px);
        padding: 1.5rem;
    }
    
    .sidebar-header h2 {
        font-size: 1.1rem;
    }
    
    .sidebar-menu a {
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
    }
}

/* Móvil - 768px */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .sidebar {
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content,
    .main {
        margin-left: 0;
        width: 100%;
        padding: 1.5rem;
        padding-top: 70px;
    }
    
    .dashboard {
        flex-direction: column;
    }
    
    .top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .top-bar h1 {
        font-size: 1.4rem;
    }
    
    .stats-grid,
    .stats-row {
        grid-template-columns: 1fr;
    }
    
    .login-box {
        padding: 2rem;
    }
    
    /* Tabla responsiva */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    th, td {
        padding: 0.8rem 1rem;
        font-size: 0.85rem;
    }
    
    .card-header {
        padding: 1rem 1.5rem;
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .modal {
        width: 95%;
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .btn {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }
}

/* Móvil pequeño - 480px */
@media (max-width: 480px) {
    .main-content,
    .main {
        padding: 1rem;
        padding-top: 65px;
    }
    
    .top-bar h1 {
        font-size: 1.2rem;
    }
    
    .tool-card h4 {
        font-size: 0.95rem;
        margin: 55px 15px 8px 15px;
    }
    
    .tool-card p {
        font-size: 0.8rem;
        margin: 0 15px 15px 15px;
    }
    
    .stat-card .stat-content {
        padding: 1rem;
    }
    
    .stat-card .stat-info h3 {
        font-size: 1.5rem;
    }
    
    .user-info {
        padding: 1rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px 14px;
        font-size: 0.95rem;
    }
}