/* assets/css/admin.css */

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

/* CSS Variables & Theme Setup */
:root {
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* Semantic Color Tokens (Light Mode Default) */
    --background: 220 33% 98%;
    --foreground: 224 71.4% 4.1%;
    --card: 0 0% 100%;
    --card-foreground: 224 71.4% 4.1%;
    --popover: 0 0% 100%;
    --popover-foreground: 224 71.4% 4.1%;
    --primary: 243 75% 59%; /* Indigo-600 */
    --primary-foreground: 210 20% 98%;
    --secondary: 220 14.3% 95.9%;
    --secondary-foreground: 220.9 39.3% 11%;
    --muted: 220 14.3% 95.9%;
    --muted-foreground: 220 8.9% 46.1%;
    --accent: 262 83% 58%; /* Purple Accent */
    --accent-foreground: 210 20% 98%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 20% 98%;
    --border: 220 13% 91%;
    --input: 220 13% 91%;
    --ring: 243 75% 59%;
    --radius: 12px;
    
    /* Extra Status Colors */
    --success: 142.1 76.2% 36.3%; /* Emerald */
    --warning: 38 92% 50%; /* Amber */
    --info: 199 89% 48%; /* Cyan */
    
    --sidebar-width: 260px;
    --header-height: 70px;
}

/* Dark Mode Overrides */
[data-theme="dark"] {
    --background: 224 71% 4%;
    --foreground: 210 20% 98%;
    --card: 224 71% 7%;
    --card-foreground: 210 20% 98%;
    --popover: 224 71% 7%;
    --popover-foreground: 210 20% 98%;
    --primary: 243 75% 59%;
    --primary-foreground: 210 20% 98%;
    --secondary: 224 71% 12%;
    --secondary-foreground: 210 20% 98%;
    --muted: 224 71% 12%;
    --muted-foreground: 217.9 10.6% 64.9%;
    --accent: 262 83% 58%;
    --accent-foreground: 210 20% 98%;
    --border: 224 71% 15%;
    --input: 224 71% 15%;
    --ring: 243 75% 59%;
}

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

body {
    font-family: var(--font-sans);
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.25;
    color: hsl(var(--foreground));
}

a {
    color: hsl(var(--primary));
    text-decoration: none;
    transition: color 0.2s ease;
}
a:hover {
    color: hsl(var(--accent));
}

/* Layout Grid */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background-color: hsl(var(--card));
    border-right: 1px solid hsl(var(--border));
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    padding: 24px 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 24px;
    margin-bottom: 16px;
    border-bottom: 1px solid hsl(var(--border));
}

.logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, hsl(var(--primary)), hsl(var(--accent)));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.2rem;
}

.logo-text {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 800;
    background: linear-gradient(135deg, hsl(var(--foreground)), hsl(var(--muted-foreground)));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius);
    color: hsl(var(--muted-foreground));
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.nav-item.active a,
.nav-item a:hover {
    background-color: hsl(var(--secondary));
    color: hsl(var(--foreground));
}

.nav-item.active a {
    border-left: 4px solid hsl(var(--primary));
    padding-left: 10px;
}

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid hsl(var(--border));
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.user-role {
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
}

/* Main Content Area */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-header {
    height: var(--header-height);
    background-color: hsl(var(--card));
    border-bottom: 1px solid hsl(var(--border));
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
}

.page-title {
    font-size: 1.5rem;
}

.main-content {
    padding: 32px;
    flex-grow: 1;
}

/* Cards & Stats */
.grid-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.card {
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.stat-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: hsl(var(--muted-foreground));
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 700;
    color: hsl(var(--foreground));
}

.stat-trend {
    font-size: 0.75rem;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.trend-up { color: hsl(var(--success)); }
.trend-down { color: hsl(var(--destructive)); }

/* Buttons & Inputs */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}
.btn-primary:hover {
    background-color: hsl(var(--accent));
}

.btn-secondary {
    background-color: hsl(var(--secondary));
    color: hsl(var(--secondary-foreground));
    border: 1px solid hsl(var(--border));
}
.btn-secondary:hover {
    background-color: hsl(var(--border));
}

.btn-danger {
    background-color: hsl(var(--destructive));
    color: hsl(var(--destructive-foreground));
}
.btn-danger:hover {
    opacity: 0.9;
}

.form-group {
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: hsl(var(--foreground));
}

.form-input,
.form-select,
.form-textarea {
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid hsl(var(--border));
    background-color: hsl(var(--card));
    color: hsl(var(--foreground));
    font-family: var(--font-sans);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: hsl(var(--primary));
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Tables */
.table-container {
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 24px;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.admin-table th {
    background-color: hsl(var(--secondary));
    padding: 14px 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    color: hsl(var(--muted-foreground));
    letter-spacing: 0.05em;
    border-bottom: 1px solid hsl(var(--border));
}

.admin-table td {
    padding: 16px 20px;
    border-bottom: 1px solid hsl(var(--border));
    font-size: 0.95rem;
    color: hsl(var(--foreground));
}

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

.admin-table tr:hover td {
    background-color: rgba(79, 70, 229, 0.02);
}

/* Status Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-open { background-color: rgba(79, 70, 229, 0.1); color: hsl(var(--primary)); }
.badge-pending { background-color: rgba(38, 92, 50, 0.1); color: hsl(var(--warning)); }
.badge-waiting { background-color: rgba(199, 89, 48, 0.1); color: hsl(var(--info)); }
.badge-resolved { background-color: rgba(142.1, 76.2%, 36.3%, 0.1); color: hsl(var(--success)); }
.badge-closed { background-color: rgba(220, 8.9%, 46.1%, 0.1); color: hsl(var(--muted-foreground)); }

.badge-low { background-color: rgba(142, 76, 36, 0.1); color: hsl(var(--success)); }
.badge-medium { background-color: rgba(199, 89, 48, 0.1); color: hsl(var(--info)); }
.badge-high { background-color: rgba(38, 92, 50, 0.1); color: hsl(var(--warning)); }
.badge-urgent { background-color: rgba(220, 38, 38, 0.1); color: hsl(var(--destructive)); }

/* Kanban Board Layout */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 16px;
    align-items: start;
}

.kanban-column {
    background-color: hsl(var(--secondary));
    border-radius: var(--radius);
    padding: 16px;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.kanban-column-title {
    font-size: 0.95rem;
    font-weight: 700;
}

.kanban-count {
    font-size: 0.75rem;
    background: hsl(var(--card));
    color: hsl(var(--muted-foreground));
    padding: 2px 6px;
    border-radius: 9999px;
    font-weight: 600;
}

.kanban-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-grow: 1;
    min-height: 400px;
}

.kanban-card {
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 8px;
    padding: 14px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    cursor: grab;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.kanban-card:active {
    cursor: grabbing;
}
.kanban-card.dragging {
    opacity: 0.5;
    border: 2px dashed hsl(var(--primary));
}

.kanban-card-title {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.kanban-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: hsl(var(--muted-foreground));
    margin-top: 8px;
}

/* Ticket Conversation Detail Thread */
.ticket-detail-grid {
    display: grid;
    grid-template-columns: 3fr 1fr;
    gap: 32px;
}

.thread-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 32px;
}

.message-card {
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 20px;
}

.message-card.internal-note {
    background-color: rgba(251, 191, 36, 0.05);
    border-color: rgba(251, 191, 36, 0.2);
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.85rem;
}

.message-sender {
    font-weight: 600;
}

.message-meta {
    color: hsl(var(--muted-foreground));
}

.message-body {
    font-size: 0.95rem;
    line-height: 1.6;
    white-space: pre-wrap;
}

.message-attachments {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid hsl(var(--border));
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.attachment-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: hsl(var(--secondary));
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    color: hsl(var(--foreground));
}

/* Forms & Sidebars */
.meta-panel {
    background-color: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: fit-content;
}

.meta-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 4px;
    border-bottom: 1px solid hsl(var(--border));
    padding-bottom: 12px;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

.meta-label {
    color: hsl(var(--muted-foreground));
}

.meta-value {
    font-weight: 500;
}

/* Login/Register Screens */
.auth-wrapper {
    min-height: 100vh;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.05) 0%, rgba(168, 85, 247, 0.05) 90.2%);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

.auth-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.auth-subtitle {
    font-size: 0.9rem;
    color: hsl(var(--muted-foreground));
}

/* Custom Alert Messages */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: hsl(var(--success));
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: hsl(var(--destructive));
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Tab Panel Styling */
.tab-container {
    display: flex;
    border-bottom: 1px solid hsl(var(--border));
    margin-bottom: 24px;
    gap: 16px;
}

.tab-btn {
    padding: 12px 16px;
    border: none;
    background: none;
    font-weight: 600;
    font-size: 0.95rem;
    color: hsl(var(--muted-foreground));
    cursor: pointer;
    position: relative;
    transition: color 0.2s ease;
}

.tab-btn:hover {
    color: hsl(var(--foreground));
}

.tab-btn.active {
    color: hsl(var(--primary));
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: hsl(var(--primary));
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: hsl(var(--border));
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--muted-foreground));
}
