@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-base: #f8fafc;
    --bg-surface: #ffffff;
    --bg-element: #f1f5f9;
    --bg-element-hover: #e2e8f0;
    
    --brand-primary: #0052cc;
    --brand-primary-rgb: 0, 82, 204;
    --brand-primary-glow: rgba(0, 82, 204, 0.15);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --border-color: #e2e8f0;
    --border-color-hover: #cbd5e1;
    
    --success: #10b981;
    --success-rgb: 16, 185, 129;
    --warning: #f59e0b;
    --warning-rgb: 245, 158, 11;
    --danger: #ef4444;
    --danger-rgb: 239, 68, 68;
    --critical: #ef4444;
    --critical-rgb: 239, 68, 68;
    --high: #f97316;
    --medium: #eab308;
    --low: #3b82f6;

    --font-heading: 'Outfit', sans-serif;
    --font-sans: 'Plus Jakarta Sans', sans-serif;
    
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    --shadow-sm: 0 1px 3px 0 rgba(0,0,0,0.1), 0 1px 2px -1px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.05), 0 4px 6px -4px rgba(0,0,0,0.05);
    --shadow-glow: 0 0 12px 0 rgba(0, 82, 204, 0.15);
    
    --transition-smooth: all 0.2s ease-in-out;
}

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

body {
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Background Aura */
body::before, body::after {
    display: none !important;
}

a {
    color: inherit;
    text-decoration: none;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.02em;
}

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

/* Sidebar Styling Override */
.sidebar {
    width: 260px;
    background-color: #1e2229 !important;
    border-right: 1px solid rgba(255, 255, 255, 0.05) !important;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem !important;
    position: sticky;
    top: 0;
    height: 100vh;
    color: #94a3b8 !important;
}

.brand {
    font-family: var(--font-heading);
    font-size: 1.25rem !important;
    font-weight: 700 !important;
    background: none !important;
    -webkit-background-clip: unset !important;
    -webkit-text-fill-color: unset !important;
    color: #ffffff !important;
    margin-bottom: 2rem !important;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.brand::before {
    content: '';
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--brand-primary) !important;
    box-shadow: 0 0 10px var(--brand-primary) !important;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex-grow: 1;
}

.nav-links .nav-item a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem !important;
    border-radius: var(--radius-sm) !important;
    color: #94a3b8 !important;
    font-weight: 500;
    font-size: 0.9rem !important;
    transition: var(--transition-smooth);
}

.nav-links .nav-item.active a {
    background: rgba(255, 255, 255, 0.06) !important;
    color: #ffffff !important;
    border-left: none !important;
    padding-left: 1rem !important;
    font-weight: 600;
}

.nav-links .nav-item a:hover {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.03) !important;
}

.user-info {
    background-color: rgba(255, 255, 255, 0.02) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    border-radius: var(--radius-md);
    padding: 0.85rem !important;
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.user-name {
    font-family: var(--font-heading);
    font-weight: 600;
    color: #ffffff !important;
    font-size: 0.95rem;
}

.user-role {
    font-size: 0.8rem;
    color: #64748b !important;
}

.logout-btn {
    background: none;
    border: none;
    color: var(--critical);
    cursor: pointer;
    text-align: left;
    padding: 0.25rem 0 0 0;
    font-weight: 600;
    font-size: 0.85rem;
    transition: var(--transition-smooth);
}

.logout-btn:hover {
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
}

/* Main Content Wrapper */
.main-content {
    flex-grow: 1;
    padding: 2.5rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
}

.header h1 {
    font-size: 1.75rem !important;
    font-weight: 700 !important;
    background: none !important;
    -webkit-background-clip: unset !important;
    -webkit-text-fill-color: unset !important;
    color: var(--text-primary) !important;
}

/* Cards Design */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(130deg, rgba(255,255,255,0.03) 0%, rgba(255,255,255,0) 80%);
    pointer-events: none;
}

.card:hover {
    transform: translateY(-4px);
    border-color: var(--border-color-hover);
    box-shadow: var(--shadow-lg);
}

.card-title {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.75rem;
}

.card-value {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 800;
    color: #fff;
}

.card-desc {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* Alert Banner */
.alert-banner {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(239, 68, 68, 0.02) 100%);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #fca5a5;
    padding: 1.25rem 1.75rem;
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    box-shadow: var(--shadow-sm);
}

.alert-title {
    font-weight: 700;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Table Design */
.table-container {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    margin-bottom: 2.5rem;
}

.table-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
}

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

th {
    background-color: #f8fafc;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1.25rem 2rem;
    border-bottom: 1px solid var(--border-color);
}

td {
    padding: 1.25rem 2rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
    color: var(--text-primary);
}

tr:hover td {
    background-color: #f8fafc;
}

tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-critical { background-color: rgba(239, 68, 68, 0.1); color: #dc2626; }
.badge-high { background-color: rgba(249, 115, 22, 0.1); color: #ea580c; }
.badge-medium { background-color: rgba(234, 179, 8, 0.1); color: #ca8a04; }
.badge-low { background-color: rgba(59, 130, 246, 0.1); color: #2563eb; }

.badge-open { background-color: rgba(99, 102, 241, 0.1); color: #4f46e5; }
.badge-assigned { background-color: rgba(14, 165, 233, 0.1); color: #0284c7; }
.badge-in_review { background-color: rgba(234, 179, 8, 0.1); color: #ca8a04; }
.badge-waiting_for_user { background-color: rgba(168, 85, 247, 0.1); color: #9333ea; }
.badge-resolved { background-color: rgba(16, 185, 129, 0.1); color: #059669; }
.badge-closed { background-color: rgba(100, 116, 139, 0.1); color: #475569; }
.badge-reopened { background-color: rgba(239, 68, 68, 0.1); color: #dc2626; }

/* Login Page Styling */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #f3f4f6;
    padding: 1.5rem;
}

.login-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.04);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.login-header {
    text-align: center;
    padding: 2.5rem 2.5rem 1.5rem;
}

.login-header h2 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #0f172a;
}

.login-header p {
    color: #64748b;
    font-size: 0.95rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
    padding: 0 2.5rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #0f172a;
}

.form-control-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.form-control-icon {
    position: absolute;
    left: 1rem;
    color: #64748b;
    font-size: 1.1rem;
    pointer-events: none;
}

.form-control {
    width: 100%;
    background-color: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    color: #0f172a;
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.form-control:focus {
    border-color: #0052cc;
    background-color: #ffffff;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 82, 204, 0.1);
}

/* Premium Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--brand-primary) 0%, var(--brand-primary-hover, #4f46e5) 100%);
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.85rem 1.75rem;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-smooth);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-color-hover);
    box-shadow: none;
    transform: none;
}

/* Ticket Details Screen */
.ticket-layout {
    display: grid;
    grid-template-columns: 2.2fr 1fr;
    gap: 2.5rem;
}

.ticket-chat-area {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.messages-thread {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-height: 600px;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
}

.message-bubble {
    padding: 1.25rem;
    border-radius: var(--radius-md);
    max-width: 85%;
    box-shadow: var(--shadow-sm);
}

.message-bubble.user {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    align-self: flex-start;
}

.message-bubble.agent {
    background-color: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    align-self: flex-end;
}

.message-bubble.internal {
    background-color: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    align-self: flex-end;
}

.message-bubble.system {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    align-self: center;
    font-size: 0.8rem;
    text-align: center;
    color: var(--text-secondary);
    max-width: 60%;
}

.message-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
}

.message-text {
    font-size: 0.95rem;
    word-break: break-word;
}

.sidebar-panel {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    box-shadow: var(--shadow-md);
}

.meta-group h3 {
    font-size: 1rem;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.meta-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-color);
}

.meta-item:last-child {
    border-bottom: none;
}
