/**
 * PS Administrador - Estilos principales
 * Colores PointSeller: Azul #007bff, Blanco, Gris #f2f2f2
 */

/* ============================================
   VARIABLES Y RESET
   ============================================ */
:root {
    --primary-color: #007bff;
    --primary-dark: #0056b3;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --gray-color: #f2f2f2;
    --white-color: #ffffff;

    --sidebar-width: 250px;
    --topbar-height: 60px;
    --footer-height: 50px;

    --box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    --box-shadow-lg: 0 4px 8px rgba(0,0,0,0.15);

    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background-color: var(--gray-color);
}

/* ============================================
   PÁGINA DE LOGIN
   ============================================ */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 10px;
    box-shadow: var(--box-shadow-lg);
    overflow: hidden;
}

.login-header {
    background: var(--primary-color);
    color: white;
    padding: 30px 20px;
    text-align: center;
}

.login-logo {
    max-width: 120px;
    margin-bottom: 15px;
    filter: brightness(0) invert(1);
}

.login-header h1 {
    font-size: 24px;
    margin-bottom: 5px;
}

.login-header p {
    font-size: 14px;
    opacity: 0.9;
}

.login-form {
    padding: 30px;
}

.login-footer {
    background: var(--gray-color);
    padding: 15px;
    text-align: center;
    font-size: 12px;
    color: #666;
}

/* ============================================
   LAYOUT PRINCIPAL
   ============================================ */
.wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Topbar */
.topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--topbar-height);
    background: white;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 1000;
    box-shadow: var(--box-shadow);
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--primary-color);
    cursor: pointer;
    padding: 8px;
    border-radius: 5px;
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: var(--gray-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    color: var(--primary-color);
}

.logo img {
    height: 35px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.topbar-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.user-role {
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 600;
}

.btn-logout {
    color: var(--danger-color);
    font-size: 18px;
    padding: 8px;
    border-radius: 5px;
    transition: var(--transition);
    text-decoration: none;
}

.btn-logout:hover {
    background: #ffe5e5;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: var(--topbar-height);
    left: 0;
    width: var(--sidebar-width);
    height: calc(100vh - var(--topbar-height));
    background: white;
    border-right: 1px solid #dee2e6;
    overflow-y: auto;
    transition: var(--transition);
    z-index: 999;
}

.sidebar.collapsed {
    margin-left: calc(-1 * var(--sidebar-width));
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li {
    border-bottom: 1px solid var(--gray-color);
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    color: #333;
    text-decoration: none;
    transition: var(--transition);
}

.sidebar-nav a:hover {
    background: var(--gray-color);
    color: var(--primary-color);
}

.sidebar-nav a.active {
    background: var(--primary-color);
    color: white;
    border-left: 4px solid var(--primary-dark);
}

.sidebar-nav i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

/* Main Content */
.main-content {
    margin-top: var(--topbar-height);
    margin-left: var(--sidebar-width);
    padding: 30px;
    min-height: calc(100vh - var(--topbar-height) - var(--footer-height));
    transition: var(--transition);
}

.sidebar.collapsed ~ .main-content {
    margin-left: 0;
}

/* Footer */
.footer {
    margin-left: var(--sidebar-width);
    background: white;
    border-top: 1px solid #dee2e6;
    padding: 15px 30px;
    text-align: center;
    font-size: 13px;
    color: #666;
    transition: var(--transition);
}

.sidebar.collapsed ~ .footer {
    margin-left: 0;
}

/* ============================================
   COMPONENTES GENERALES
   ============================================ */

/* Botones */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1.5;
}

.btn i {
    margin-right: 5px;
}

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

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

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-warning {
    background: var(--warning-color);
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-info {
    background: var(--info-color);
    color: white;
}

.btn-info:hover {
    background: #138496;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-block {
    display: block;
    width: 100%;
}

.btn-group {
    display: flex;
    gap: 5px;
}

/* Formularios */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ced4da;
    border-radius: 5px;
    font-size: 14px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

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

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

.col-md-3 { flex: 0 0 25%; }
.col-md-4 { flex: 0 0 33.333%; }
.col-md-6 { flex: 0 0 50%; }
.col-md-8 { flex: 0 0 66.666%; }

.form-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--gray-color);
    display: flex;
    gap: 10px;
}

/* Tarjetas */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: var(--box-shadow);
    margin-bottom: 25px;
    overflow: hidden;
}

.card-header {
    background: var(--gray-color);
    padding: 15px 20px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    margin: 0;
    font-size: 18px;
    color: #333;
}

.card-body {
    padding: 20px;
}

/* Tablas */
.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table thead {
    background: var(--gray-color);
}

.table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #dee2e6;
}

.table td {
    padding: 12px 15px;
    border-bottom: 1px solid #dee2e6;
}

.table tbody tr:hover {
    background: #f8f9fa;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
}

.badge-primary { background: var(--primary-color); color: white; }
.badge-success { background: var(--success-color); color: white; }
.badge-danger { background: var(--danger-color); color: white; }
.badge-warning { background: var(--warning-color); color: #212529; }
.badge-info { background: var(--info-color); color: white; }
.badge-secondary { background: var(--secondary-color); color: white; }

/* ============================================
   DASHBOARD
   ============================================ */
.dashboard {
    max-width: 1400px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 28px;
    color: #333;
    margin-bottom: 5px;
}

.page-header p {
    color: #666;
    font-size: 14px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.kpi-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--box-shadow-lg);
}

.kpi-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.kpi-icon.blue { background: var(--primary-color); }
.kpi-icon.green { background: var(--success-color); }
.kpi-icon.purple { background: #6f42c1; }
.kpi-icon.orange { background: #fd7e14; }

.kpi-content h3 {
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 5px;
    color: #333;
}

.kpi-content p {
    font-size: 14px;
    color: #666;
    margin-bottom: 3px;
}

.kpi-content small {
    font-size: 12px;
    color: #999;
}

/* Alertas */
.alerts-section {
    margin-bottom: 30px;
}

.alerts-section h2 {
    font-size: 22px;
    margin-bottom: 20px;
    color: #333;
}

.alerts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
}

.alert-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--box-shadow);
}

.alert-header {
    padding: 15px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
}

.alert-danger .alert-header {
    background: #f8d7da;
    color: var(--danger-color);
}

.alert-warning .alert-header {
    background: #fff3cd;
    color: #856404;
}

.alert-header h3 {
    flex: 1;
    font-size: 16px;
    margin: 0;
}

.alert-body {
    padding: 15px 20px;
}

.alert-body ul {
    list-style: none;
    padding: 0;
    margin: 0 0 15px 0;
}

.alert-body li {
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-color);
}

.alert-body li:last-child {
    border-bottom: none;
}

/* ============================================
   PÁGINAS ESPECÍFICAS
   ============================================ */
.page-container {
    max-width: 1400px;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-box {
    background: white;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: var(--box-shadow);
    border-left: 4px solid var(--primary-color);
}

.stat-box.stat-success { border-left-color: var(--success-color); }
.stat-box.stat-warning { border-left-color: var(--warning-color); }
.stat-box.stat-info { border-left-color: var(--info-color); }
.stat-box.stat-danger { border-left-color: var(--danger-color); }

.stat-box i {
    font-size: 32px;
    color: var(--primary-color);
}

.stat-box.stat-success i { color: var(--success-color); }
.stat-box.stat-warning i { color: var(--warning-color); }
.stat-box.stat-info i { color: var(--info-color); }

.stat-box h3 {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 5px;
}

.stat-box p {
    font-size: 14px;
    color: #666;
}

.search-box {
    position: relative;
}

.search-box input {
    padding-right: 40px;
}

.search-box i {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.recent-section {
    margin-top: 30px;
}

.recent-section h2 {
    font-size: 22px;
    margin-bottom: 20px;
    color: #333;
}

.text-muted {
    color: #6c757d !important;
}

.text-center {
    text-align: center !important;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .sidebar {
        margin-left: calc(-1 * var(--sidebar-width));
    }

    .sidebar.active {
        margin-left: 0;
    }

    .main-content,
    .footer {
        margin-left: 0 !important;
    }

    .form-row {
        flex-direction: column;
    }

    .kpi-grid,
    .alerts-grid,
    .stats-row {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
}

/* ============================================
   UTILIDADES
   ============================================ */
.mb-20 { margin-bottom: 20px; }
.mt-20 { margin-top: 20px; }
.p-20 { padding: 20px; }
.text-right { text-align: right; }
