/**
 * Estilos del Sistema de Gestión de Tickets
 */

/* ===== VARIABLES ===== */
:root {
    --primary-color: #3498db;
    --secondary-color: #2c3e50;
    --success-color: #2ecc71;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --info-color: #3498db;
    --light-bg: #ecf0f1;
    --dark-text: #2c3e50;
    --border-color: #bdc3c7;
    --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* ===== RESET ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--light-bg);
    color: var(--dark-text);
    line-height: 1.6;
}

/* ===== LOGIN PAGE ===== */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-card {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.login-card h1 {
    text-align: center;
    margin-bottom: 10px;
    color: var(--secondary-color);
}

.login-card .subtitle {
    text-align: center;
    color: #7f8c8d;
    margin-bottom: 30px;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    color: #95a5a6;
    font-size: 0.9em;
}

/* ===== NAVBAR ===== */
.navbar {
    background: var(--secondary-color);
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

.nav-brand h2 {
    margin: 0;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.nav-user span {
    font-size: 0.9em;
}

/* ===== CONTAINER ===== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== TABS ===== */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.tab-btn {
    padding: 10px 20px;
    border: none;
    background: white;
    cursor: pointer;
    border-radius: 5px;
    font-weight: 500;
    transition: all 0.3s;
}

.tab-btn:hover {
    background: var(--light-bg);
}

.tab-btn.active {
    background: var(--primary-color);
    color: white;
}

/* ===== METRICS GRID ===== */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.3s;
}

.metric-card:hover {
    transform: translateY(-5px);
}

.metric-icon {
    font-size: 3em;
}

.metric-content h3 {
    font-size: 0.9em;
    color: #7f8c8d;
    margin-bottom: 5px;
}

.metric-value {
    font-size: 2em;
    font-weight: bold;
    margin: 0;
}

.card-blue {
    border-left: 5px solid var(--primary-color);
}

.card-yellow {
    border-left: 5px solid var(--warning-color);
}

.card-orange {
    border-left: 5px solid #e67e22;
}

.card-green {
    border-left: 5px solid var(--success-color);
}

/* ===== CHARTS ===== */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.chart-card {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.chart-card h3 {
    margin-bottom: 15px;
}

.chart-card canvas {
    max-height: 300px;
}

/* ===== TABLE ===== */
.table-container {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.table-header h3 {
    margin: 0;
}

.table-header input {
    padding: 8px 15px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    width: 300px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--light-bg);
}

th,
td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: 600;
    color: var(--secondary-color);
}

tbody tr:hover {
    background: #f8f9fa;
}

.text-center {
    text-align: center !important;
}

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 500;
    margin: 0 2px;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

.badge-secondary {
    background: #e2e3e5;
    color: #383d41;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-block;
}

.btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.9em;
}

.btn-block {
    width: 100%;
    display: block;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--secondary-color);
}

.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1em;
    font-family: inherit;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    overflow: auto;
}

.modal-content {
    background: white;
    margin: 50px auto;
    padding: 30px;
    border-radius: 10px;
    max-width: 800px;
    position: relative;
    animation: slideDown 0.3s;
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    justify-content: flex-end;
}

/* ===== TICKET INFO ===== */
.ticket-info {
    background: var(--light-bg);
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.ticket-info p {
    margin: 5px 0;
}

/* ===== EQUIPO CARD ===== */
.equipo-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 10px;
    border-left: 4px solid var(--primary-color);
}

.equipo-card label {
    font-weight: 600;
    margin-bottom: 5px;
    display: block;
}

.equipo-card small {
    color: #6c757d;
}

/* ===== MESSAGES ===== */
.error-message,
.error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 5px;
    border-left: 4px solid var(--danger-color);
    margin: 10px 0;
}

.success-message,
.success {
    background: #d4edda;
    color: #155724;
    padding: 12px;
    border-radius: 5px;
    border-left: 4px solid var(--success-color);
    margin: 10px 0;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #6c757d;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 10px;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .charts-container {
        grid-template-columns: 1fr;
    }

    .table-header {
        flex-direction: column;
        align-items: stretch;
    }

    .table-header input {
        width: 100%;
    }

    table {
        font-size: 0.9em;
    }

    th,
    td {
        padding: 8px;
    }
}

/* ===== HISTORIAL PANEL ===== */
.historial-panel {
    position: fixed;
    right: -450px;
    top: 0;
    width: 450px;
    height: 100vh;
    background: white;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.2);
    transition: right 0.3s ease;
    z-index: 1001;
    display: flex;
    flex-direction: column;
}

.historial-panel.open {
    right: 0;
}

.historial-header {
    background: var(--secondary-color);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.historial-header h3 {
    margin: 0;
}

.btn-close-historial {
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s;
}

.btn-close-historial:hover {
    background: rgba(255, 255, 255, 0.1);
}

.historial-ticket-info {
    background: var(--light-bg);
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.historial-ticket-info p {
    margin: 5px 0;
    font-size: 0.9em;
}

.historial-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.mensaje {
    margin-bottom: 15px;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mensaje-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
    font-size: 0.85em;
    color: #666;
}

.mensaje-header .fecha {
    font-size: 0.9em;
}

.mensaje-body {
    padding: 12px;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    word-wrap: break-word;
}

.mensaje.callcenter .mensaje-body {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
}

.mensaje.supervisor .mensaje-body {
    background: #dcf8c6;
    border-left: 4px solid #28a745;
}

.mensaje .metadata {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 0.9em;
}

.mensaje .metadata strong {
    color: #333;
}

/* Responsive para panel */
@media (max-width: 768px) {
    .historial-panel {
        width: 100%;
        right: -100%;
    }
}