/* ===== Variables CSS ===== */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --dark-color: #1f2937;
    --light-gray: #f3f4f6;
    --medium-gray: #9ca3af;
    --border-color: #e5e7eb;
    --text-color: #111827;
    --white: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

/* ===== Reset y Base ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--text-color);
    background-color: var(--light-gray);
    line-height: 1.6;
}

/* ===== Login Page ===== */
.login-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    max-width: 1200px;
    width: 100%;
    background: var(--white);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.login-left {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--white);
    padding: 60px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-brand i {
    font-size: 3.5rem;
    margin-bottom: 20px;
}

.login-brand h1 {
    font-size: 2rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.login-brand p {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 40px;
}

.features-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1rem;
}

.feature-item i {
    font-size: 1.5rem;
    color: var(--secondary-color);
}

.login-right {
    padding: 60px 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-box {
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: var(--text-color);
}

.login-subtitle {
    color: var(--medium-gray);
    margin-bottom: 30px;
}

.login-form {
    margin-bottom: 30px;
}

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

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: var(--text-color);
    font-weight: 500;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.9rem;
}

.forgot-password {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.forgot-password:hover {
    text-decoration: underline;
}

.btn-primary, .btn-secondary {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--white);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--light-gray);
}

.divider {
    position: relative;
    text-align: center;
    margin: 30px 0;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
}

.divider span {
    position: relative;
    background: var(--white);
    padding: 0 15px;
    color: var(--medium-gray);
    font-size: 0.9rem;
}

.demo-credentials {
    margin-top: 30px;
    padding: 20px;
    background: var(--light-gray);
    border-radius: 8px;
}

.demo-credentials p {
    margin-bottom: 15px;
    color: var(--text-color);
}

.demo-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.demo-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.85rem;
}

.demo-item strong {
    color: var(--primary-color);
}

.demo-item span {
    color: var(--medium-gray);
    font-family: monospace;
}

/* ===== Dashboard Layout ===== */
.dashboard-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--dark-color);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 1000;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.2rem;
    font-weight: 700;
}

.sidebar-brand i {
    font-size: 1.5rem;
    color: var(--secondary-color);
}

.sidebar-menu {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.menu-section-title {
    padding: 15px 20px 10px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--medium-gray);
    font-weight: 600;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.menu-item.active {
    background: var(--primary-color);
    color: var(--white);
    border-left: 4px solid var(--secondary-color);
}

.menu-item i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--medium-gray);
}

.btn-logout {
    width: 100%;
    padding: 10px;
    background: var(--danger-color);
    color: var(--white);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.main-content {
    flex: 1;
    margin-left: 260px;
    background: var(--light-gray);
}

.topbar {
    background: var(--white);
    padding: 20px 30px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.topbar-left h1 {
    font-size: 1.5rem;
    color: var(--text-color);
}

.breadcrumb {
    color: var(--medium-gray);
    font-size: 0.9rem;
    margin-top: 5px;
}

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

.notification-icon {
    position: relative;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-color);
}

.notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--danger-color);
    color: var(--white);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.content-area {
    padding: 30px;
}

/* ===== Cards ===== */
.card {
    background: var(--white);
    border-radius: 10px;
    padding: 25px;
    box-shadow: var(--shadow);
    margin-bottom: 25px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--light-gray);
}

.card-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-color);
}

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

.stat-card {
    background: var(--white);
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.stat-icon.blue {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

.stat-icon.green {
    background: rgba(16, 185, 129, 0.1);
    color: var(--secondary-color);
}

.stat-icon.yellow {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.stat-icon.red {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.stat-info h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-info p {
    color: var(--medium-gray);
    font-size: 0.9rem;
}

/* ===== Tables ===== */
.table-container {
    overflow-x: auto;
}

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

thead {
    background: var(--light-gray);
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-color);
    font-size: 0.9rem;
}

td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

tbody tr:hover {
    background: var(--light-gray);
}

/* ===== Badges ===== */
.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--secondary-color);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--info-color);
}

.badge-primary {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
}

/* ===== Buttons ===== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.btn i {
    font-size: 0.9rem;
}

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

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

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

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

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

/* ===== Notifications ===== */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: none;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

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

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

.notification.show {
    display: flex;
}

/* ===== Modals ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: 12px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--medium-gray);
}

/* ===== Forms ===== */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group-full {
    grid-column: 1 / -1;
}

select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s;
}

select:focus {
    outline: none;
    border-color: var(--primary-color);
}

textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    resize: vertical;
    min-height: 100px;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }
    
    .main-content {
        margin-left: 220px;
    }
}

@media (max-width: 768px) {
    .login-container {
        grid-template-columns: 1fr;
    }
    
    .login-left {
        display: none;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ===== Camera/Webcam Styles ===== */
.camera-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin: 20px auto;
}

.camera-preview {
    width: 100%;
    border-radius: 10px;
    border: 3px solid var(--primary-color);
}

.camera-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 15px;
}

.captured-image {
    max-width: 100%;
    border-radius: 10px;
    margin-top: 20px;
}

/* ===== QR Code Styles ===== */
.qr-container {
    text-align: center;
    padding: 20px;
}

.qr-code-image {
    max-width: 200px;
    margin: 20px auto;
    display: block;
}

/* ===== Badge Preview ===== */
.badge-preview {
    max-width: 400px;
    margin: 20px auto;
    padding: 30px;
    border: 2px dashed var(--primary-color);
    border-radius: 10px;
    text-align: center;
    background: var(--light-gray);
}

.badge-preview img {
    max-width: 150px;
    border-radius: 10px;
    margin-bottom: 15px;
}

/* ===== Loading Spinner ===== */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Utilities ===== */
.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.hidden {
    display: none;
}
