/* Variables CSS */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;

    --sidebar-width: 250px;
    --navbar-height: 56px;
}

/* Reset y base */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-color);
    min-height: 100vh;
}

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

.login-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
}

.login-logo {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo h1 {
    color: var(--dark-color);
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.login-logo p {
    color: var(--secondary-color);
    font-size: 0.9rem;
}

.login-form .form-control {
    padding: 0.75rem 1rem;
    border-radius: 8px;
}

.login-form .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.15);
}

.login-form .btn-primary {
    padding: 0.75rem;
    border-radius: 8px;
    font-weight: 600;
}

/* Layout principal */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--dark-color);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
}

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

.sidebar-header h5 {
    margin: 0;
    font-weight: 600;
}

.sidebar-nav {
    padding: 1rem 0;
}

.sidebar-nav .nav-link {
    color: rgba(255, 255, 255, 0.7);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-nav .nav-link i {
    width: 20px;
    text-align: center;
}

/* Main content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

/* Navbar */
.top-navbar {
    background: white;
    border-bottom: 1px solid #dee2e6;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-search {
    max-width: 400px;
    flex: 1;
}

.navbar-search .form-control {
    border-radius: 20px;
    padding-left: 2.5rem;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Page content */
.page-content {
    flex: 1;
    padding: 1.5rem;
}

/* Cards */
.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark-color);
}

.stat-card .stat-label {
    color: var(--secondary-color);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Task cards */
.task-card {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.2s;
    border-left: 4px solid transparent;
}

.task-card:hover {
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
}

.task-card.priority-urgent {
    border-left-color: var(--danger-color);
}

.task-card.priority-high {
    border-left-color: var(--warning-color);
}

.task-card.priority-medium {
    border-left-color: var(--info-color);
}

.task-card.priority-low {
    border-left-color: var(--secondary-color);
}

.task-card .task-subject {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.task-card .task-customer {
    font-size: 0.875rem;
    color: var(--secondary-color);
}

.task-card .task-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: var(--secondary-color);
}

/* Status badges */
.badge-status {
    font-size: 0.75rem;
    padding: 0.35rem 0.65rem;
    border-radius: 20px;
}

.badge-pending-response {
    background-color: #fff3cd;
    color: #856404;
}

.badge-pending-customer {
    background-color: #cce5ff;
    color: #004085;
}

.badge-transferred {
    background-color: #e2e3e5;
    color: #383d41;
}

.badge-resolved {
    background-color: #d4edda;
    color: #155724;
}

.badge-closed {
    background-color: #f8f9fa;
    color: #6c757d;
}

/* Kanban columns */
.kanban-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.kanban-column {
    background: #f1f3f5;
    border-radius: 12px;
    padding: 1rem;
    min-height: 400px;
}

.kanban-column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #dee2e6;
}

.kanban-column-header h6 {
    margin: 0;
    font-weight: 600;
}

.kanban-column-header .badge {
    font-size: 0.75rem;
}

/* Task detail */
.task-detail-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1.5rem;
    height: calc(100vh - var(--navbar-height) - 3rem);
}

.task-sidebar {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    overflow-y: auto;
}

.task-main {
    display: flex;
    flex-direction: column;
    background: white;
    border-radius: 12px;
    overflow: hidden;
}

.message-list {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
}

.message-item {
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 8px;
}

.message-item.inbound {
    background: #f8f9fa;
    margin-right: 2rem;
}

.message-item.outbound {
    background: #e7f5ff;
    margin-left: 2rem;
}

.message-composer {
    border-top: 1px solid #dee2e6;
    padding: 1rem;
}

.message-composer textarea {
    resize: none;
    border-radius: 8px;
}

/* Responsive */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .task-detail-container {
        grid-template-columns: 1fr;
    }

    .task-sidebar {
        display: none;
    }
}

/* Utilities */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Loading spinner */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
}

.toast {
    min-width: 300px;
}
