/* Root Variables */
:root {
    --main-bg-color: #2c3e50;    /* Dark blue background */
    --secondary-bg-color: #34495e; /* Slightly lighter blue */
    --accent-color: #3498db;     /* Bright blue for accents */
    --text-color: #ecf0f1;       /* Light gray text */
    --link-color: #bdc3c7;       /* Lighter gray for links */
    --hover-color: #3498db;      /* Bright blue for hover */
    --danger-color: #e74c3c;     /* Red for logout/danger */
    --danger-hover: #c0392b;     /* Darker red for hover */
    --shadow: 0 4px 15px rgba(0,0,0,0.2);
    --font-family: 'Roboto', sans-serif;
    --header-height: 60px;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    line-height: 1.6;
    background-color: #f8f9fa;
}

/* Header Styles */
header {
    background-color: var(--main-bg-color);
    color: var(--text-color);
    border: none;
    border-radius: 0;
    box-shadow: var(--shadow);
    padding: 0 20px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-title h1 {
    color: var(--text-color);
}

.header-subtitle {
    color: var(--link-color);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-logo {
    height: 40px;
    width: auto;
}

.header-title {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

header h1 {
    font-size: 1.4rem;
    margin: 0;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.header-subtitle {
    font-size: 0.75rem;
    color: #bdc3c7;
    font-weight: 300;
    letter-spacing: 0.3px;
    margin-top: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

@media (max-width: 768px) {
    .header-subtitle {
        display: none;
    }
    
    .header-logo {
        height: 35px;
    }
    
    header h1 {
        font-size: 1.2rem;
    }
}

/* Sidebar Styles */
#sidebar {
    width: 280px;
    background: var(--main-bg-color);
    color: var(--text-color);
    height: 100vh;
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
}

.menu-header {
    padding: 20px;
    background: var(--secondary-bg-color);
    border-bottom: 1px solid var(--main-bg-color);
}

.menu-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
}

.menu-header h2 i {
    margin-right: 10px;
    color: var(--accent-color);
}

/* Accordion Menu Styles */
.accordion {
    padding: 15px;
    flex-grow: 1;
}

.card {
    background: transparent;
    border: none;
    margin-bottom: 10px;
}

.card-header {
    background: transparent;
    border: none;
    padding: 0;
}

.card-header button {
    color: var(--text-color);
    text-decoration: none;
    width: 100%;
    text-align: left;
    padding: 12px 20px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    transition: all 0.2s ease;
    border-radius: 4px;
    background: transparent;
    border: none;
}

.card-header button:hover,
.card-header button[aria-expanded="true"] {
    background: var(--secondary-bg-color);
    color: var(--accent-color);
}

.card-header button i {
    width: 25px;
    margin-right: 12px;
    font-size: 1.1rem;
}

.card-body {
    padding: 10px 0 10px 40px;
}

/* Dashboard Link Styles */
.dashboard-link {
    background-color: rgba(52, 152, 219, 0.1) !important;
    border-left: 4px solid var(--accent-color) !important;
    font-weight: 500 !important;
    margin: 10px 0 !important;
}

.dashboard-link:hover {
    background-color: rgba(52, 152, 219, 0.2) !important;
    border-left-color: #2980b9 !important;
}

/* Menu Section Styles */
.menu-section {
    margin-bottom: 1.5rem;
}

.menu-section h6 {
    color: #95a5a6;
    font-size: 0.8rem;
    text-transform: uppercase;
    margin: 1rem 0 0.5rem 1rem;
    letter-spacing: 0.5px;
}

.menu-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.menu-section ul li {
    margin: 5px 0;
}

.menu-section ul li a {
    color: var(--link-color);
    text-decoration: none;
    padding: 8px 15px;
    display: flex;
    align-items: center;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.menu-section ul li a:hover {
    background: var(--secondary-bg-color);
    color: var(--hover-color);
    padding-left: 20px;
}

/* Logout Container */
.logout-container {
    padding: 20px;
    background: var(--secondary-bg-color);
    margin-top: auto;
}

.logout-container ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.logout-container ul li a {
    color: var(--text-color);
    text-decoration: none;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    background: var(--danger-color);
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.logout-container ul li a:hover {
    background: var(--danger-hover);
}

.logout-container ul li a i {
    margin-right: 10px;
}

/* Content Area */
#content {
    margin-left: 280px; /* Espacio para la barra lateral */
    padding: 20px; /* Reducir padding si es necesario */
    padding-top: calc(var(--header-height) + 20px); /* Espacio para el header fijo */
    height: 100vh; /* Ocupa toda la altura de la ventana */
    display: flex; /* Habilitar Flexbox */
    flex-direction: column; /* Apilar elementos verticalmente */
    overflow-y: auto; /* Permitir scroll si el contenido excede */
    background: #f8f9fa;
}

/* Dashboard Styles */
.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
}

.dashboard-welcome {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
}

.welcome-content {
    max-width: 60%;
}

.welcome-title {
    font-size: 2rem;
    color: var(--main-bg-color);
    margin-bottom: 1rem;
}

.welcome-title .username {
    color: var(--accent-color);
}

.welcome-text {
    color: #666;
    font-size: 1.1rem;
    line-height: 1.6;
}

.welcome-illustration img.dashboard-logo {
    width: 250px;
    height: auto;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.1));
    transition: transform 0.3s ease;
}

.welcome-illustration img.dashboard-logo:hover {
    transform: scale(1.05);
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1.5rem;
}

.stat-icon i {
    color: white;
    font-size: 1.5rem;
}

.stat-value {
    font-size: 2rem;
    color: var(--main-bg-color);
    margin-bottom: 0.25rem;
}

.stat-label {
    color: #666;
    font-size: 0.9rem;
}

.dashboard-activity {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.section-title {
    color: var(--main-bg-color);
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.activity-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border-radius: 10px;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.activity-item:hover {
    background: var(--accent-color);
    color: white;
}

.activity-item:hover .activity-content h4,
.activity-item:hover .activity-content p {
    color: white;
}

.activity-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 1.5rem;
}

.activity-icon i {
    color: white;
    font-size: 1.2rem;
}

.activity-content h4 {
    color: var(--main-bg-color);
    margin-bottom: 0.25rem;
    font-size: 1.1rem;
}

.activity-content p {
    color: #666;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

.activity-time {
    color: #999;
    font-size: 0.8rem;
}

.dashboard-actions {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: var(--shadow);
}

.action-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.action-button {
    background: var(--accent-color);
    color: white;
    padding: 1.5rem;
    border-radius: 15px;
    text-align: center;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.action-button:hover {
    background: var(--main-bg-color);
    transform: translateY(-5px);
}

.action-button i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.action-button span {
    font-size: 1rem;
}

@media (max-width: 768px) {
    .dashboard-welcome {
        flex-direction: column;
        text-align: center;
    }
    
    .welcome-content {
        max-width: 100%;
        margin-bottom: 1.5rem;
    }
    
    .welcome-illustration img {
        width: 200px;
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
    }
    
    .stat-icon {
        margin-right: 0;
        margin-bottom: 1rem;
    }
}

/* Tickets Styles */
.tickets-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.tickets-title {
    color: var(--main-bg-color);
    font-size: 2rem;
    font-weight: 600;
}

.tickets-actions {
    display: flex;
    gap: 1rem;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: #f8f9fa;
    color: var(--main-bg-color);
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background-color: #e9ecef;
}

.tickets-filters {
    margin-bottom: 2rem;
}

.filters-container {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 1.5rem;
    margin-top: 1rem;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.filter-group {
    margin-bottom: 1rem;
}

.filter-group label {
    display: block;
    color: var(--main-bg-color);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-select {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.form-select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

/* Tickets Table */
.tickets-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.tickets-table th,
.tickets-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
}

.tickets-table th {
    background-color: var(--main-bg-color);
    color: white;
    font-weight: 500;
}

.tickets-table tr:hover {
    background-color: #f8f9fa;
}

.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-new {
    background-color: #d1fae5;
    color: #065f46;
}

.status-in_progress {
    background-color: #dbeafe;
    color: #1e40af;
}

.status-resolved {
    background-color: #fef3c7;
    color: #92400e;
}

.status-closed {
    background-color: #f3f4f6;
    color: #374151;
}

.priority-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.priority-critical {
    background-color: #fee2e2;
    color: #991b1b;
}

.priority-high {
    background-color: #ffedd5;
    color: #9a3412;
}

.priority-medium {
    background-color: #fef3c7;
    color: #92400e;
}

.priority-low {
    background-color: #dcfce7;
    color: #166534;
}

/* Button Styles */
.btn {
    padding: 8px 16px;
    border-radius: 4px;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: var(--danger-hover);
}

/* Form Styles */
form {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 1rem;
}

.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    border-color: var(--accent-color);
    outline: none;
}

/* Icon Styles */
.fa-sm {
    font-size: 0.8em;
    width: 20px;
    text-align: center;
}

/* Responsive Styles */
@media (max-width: 768px) {
    #sidebar {
        width: 100%;
        height: auto;
        position: fixed;
        z-index: 1000;
        left: -100%;
        transition: left 0.3s ease;
    }

    #sidebar.active {
        left: 0;
    }

    #content {
        margin-left: 0;
        padding-top: calc(var(--header-height) + 10px);
    }

    header {
        padding: 10px;
    }

    .table-responsive {
        margin: 0;
    }
}

/* SweetAlert2 Custom Styles */
.swal-container {
    z-index: 10000;
}

.swal-popup {
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.swal-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
}

.swal-content {
    font-size: 1rem;
    color: #666;
    margin: 1rem 0;
}

.swal-actions {
    gap: 1rem;
    margin-top: 1.5rem;
}

.swal-confirm {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.swal-confirm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.swal-cancel {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    background-color: #95a5a6;
    border: none;
}

.swal-cancel:hover {
    background-color: #7f8c8d;
    transform: translateY(-1px);
}

/* Bootstrap Modal Z-index Fix (Preventivo) */
.modal-backdrop {
  z-index: 1040 !important;
}
.modal {
  z-index: 1050 !important;
}

/* Ask Cory Widget Styles */
#askCoryWidget {
    position: fixed;
    bottom: 90px;
    right: 30px;
    width: 350px;
    height: 500px;
    z-index: 1000;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

#askCoryWidget.visible {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.chat-header {
    background: var(--accent-color);
    color: white;
    padding: 15px;
}

.chat-header-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.cory-gif {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.cory-gif img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#askCoryChat {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f9fa;
}

.message {
    max-width: 80%;
    padding: 10px 15px;
    border-radius: 15px;
    font-size: 14px;
    line-height: 1.4;
}

.message.user {
    background: var(--accent-color);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}

.message.bot {
    background: white;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.chat-input-area {
    padding: 15px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    align-items: center;
}

#toggleAskCory {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1002;
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: var(--shadow);
    font-size: 16px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

#toggleAskCory:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
}

/* Upload Styles */
.upload-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    background: white;
    border-radius: 15px;
    box-shadow: var(--shadow);
}

.upload-header {
    margin-bottom: 2rem;
    text-align: center;
}

.upload-title {
    color: var(--main-bg-color);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.upload-subtitle {
    color: #666;
    font-size: 1rem;
}

.upload-dropzone {
    border: 2px dashed var(--accent-color);
    border-radius: 15px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(52, 152, 219, 0.05);
}

.upload-dropzone:hover {
    background: rgba(52, 152, 219, 0.1);
    transform: translateY(-2px);
}

.dropzone-content {
    max-width: 500px;
    margin: 0 auto;
}

.dropzone-text {
    color: #666;
    margin: 1rem 0;
    font-size: 1.1rem;
}

.upload-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
}

.upload-btn-primary {
    background-color: var(--accent-color);
    color: white;
    box-shadow: var(--shadow);
}

.upload-btn-primary:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
}

.upload-btn-danger {
    background-color: var(--danger-color);
    color: white;
    box-shadow: var(--shadow);
}

.upload-btn-danger:hover {
    background-color: var(--danger-hover);
    transform: translateY(-2px);
}

.upload-info {
    color: #666;
    font-size: 0.9rem;
    margin-top: 1.5rem;
    line-height: 1.6;
}

.upload-status {
    margin: 1rem 0;
    padding: 0.75rem;
    border-radius: 4px;
    background: #f8f9fa;
    color: #666;
    font-size: 0.9rem;
    min-height: 20px;
}

.upload-list {
    margin-top: 2rem;
}

.upload-summary {
    margin-top: 2rem;
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.upload-summary .card-title {
    color: var(--main-bg-color);
    margin-bottom: 1.5rem;
}

.upload-summary p {
    color: #666;
    margin-bottom: 0.5rem;
}

#pending-uploads {
    margin-top: 2rem;
}

#pending-uploads .card {
    border: none;
    box-shadow: var(--shadow);
}

#pending-uploads .card-title {
    color: var(--main-bg-color);
}

#pending-uploads .list-group-item {
    border: none;
    padding: 1rem;
    margin: 0.5rem 0;
    border-radius: 10px;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

#pending-uploads .list-group-item:hover {
    background: #e9ecef;
}

#pending-uploads .btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 20px;
}
