/* Premium Admin Panel CSS - ProcureX */
@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');

:root {
    --bg-primary: #090d16;
    --bg-secondary: #0f172a;
    --sidebar-bg: #090d16;
    --sidebar-width: 260px;
    --accent-primary: #6366f1;
    --accent-secondary: #a855f7;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-color: rgba(255, 255, 255, 0.08);
    --glass-bg: rgba(15, 23, 42, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Status Colors */
    --status-new-bg: rgba(99, 102, 241, 0.15);
    --status-new-color: #818cf8;
    --status-review-bg: rgba(59, 130, 246, 0.15);
    --status-review-color: #60a5fa;
    --status-quoted-bg: rgba(245, 158, 11, 0.15);
    --status-quoted-color: #fbbf24;
    --status-closed-bg: rgba(16, 185, 129, 0.15);
    --status-closed-color: #34d399;
    --status-retracted-bg: rgba(239, 68, 68, 0.15);
    --status-retracted-color: #f87171;
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Sidebar Navigation */
.admin-sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
}

.sidebar-logo {
    padding: 2rem 1.5rem;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.03em;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo span {
    color: var(--text-primary);
    -webkit-text-fill-color: var(--text-primary);
    font-weight: 400;
}

.sidebar-menu {
    list-style: none;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.sidebar-menu-item a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
}

.sidebar-menu-item a:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.04);
}

.sidebar-menu-item.active a {
    color: #fff;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.sidebar-menu-item svg {
    width: 20px;
    height: 20px;
    opacity: 0.8;
}

.sidebar-user {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
}

.user-info {
    font-size: 0.85rem;
}

.user-name {
    font-weight: 600;
    color: #fff;
}

.user-role {
    color: var(--text-muted);
}

.logout-btn {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.logout-btn:hover {
    color: var(--status-retracted-color);
}

/* Main Layout Area */
.admin-main {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-width: 0;
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

/* Top Admin Header */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.admin-header h1 {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.admin-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

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

.metric-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    transition: var(--transition);
}

.metric-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.15);
}

.metric-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-value {
    font-family: var(--font-heading);
    font-size: 2.25rem;
    font-weight: 800;
    color: #fff;
    line-height: 1;
}

/* Filter Controls */
.filter-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
}

.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
    min-width: 180px;
}

.filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.filter-input {
    padding: 0.65rem 0.85rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: #fff;
    font-family: var(--font-body);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition);
}

.filter-input:focus {
    border-color: var(--accent-primary);
    background: rgba(255, 255, 255, 0.06);
}

.btn-filter, .btn-action {
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    transition: var(--transition);
}

.btn-primary {
    background: var(--accent-primary);
    color: #fff;
}

.btn-primary:hover {
    background: #4f46e5;
    transform: translateY(-1px);
}

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

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

/* Data Tables */
.table-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 2rem;
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.data-table th {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem 1.5rem;
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

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

.data-table tr {
    transition: var(--transition);
}

.data-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

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

.badge-new {
    background: var(--status-new-bg);
    color: var(--status-new-color);
}

.badge-in_review {
    background: var(--status-review-bg);
    color: var(--status-review-color);
}

.badge-quoted {
    background: var(--status-quoted-bg);
    color: var(--status-quoted-color);
}

.badge-closed {
    background: var(--status-closed-bg);
    color: var(--status-closed-color);
}

.badge-retracted {
    background: var(--status-retracted-bg);
    color: var(--status-retracted-color);
}

/* Ticket Detail Cards */
.ticket-detail-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
}

.detail-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 2rem;
    backdrop-filter: blur(12px);
    margin-bottom: 2rem;
}

.detail-card-title {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.detail-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 1.25rem;
}

.detail-row label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-row span {
    font-size: 1rem;
}

.ticket-desc {
    background: rgba(0, 0, 0, 0.15);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    border-radius: 8px;
    white-space: pre-wrap;
    font-size: 0.95rem;
}

/* Side Action Menu */
.sidebar-action-card {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.status-flow-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.status-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-family: var(--font-heading);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-secondary);
    transition: var(--transition);
}

.status-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.status-btn.active-new { border-color: var(--status-new-color); color: var(--status-new-color); background: var(--status-new-bg); }
.status-btn.active-in_review { border-color: var(--status-review-color); color: var(--status-review-color); background: var(--status-review-bg); }
.status-btn.active-quoted { border-color: var(--status-quoted-color); color: var(--status-quoted-color); background: var(--status-quoted-bg); }
.status-btn.active-closed { border-color: var(--status-closed-color); color: var(--status-closed-color); background: var(--status-closed-bg); }
.status-btn.active-retracted { border-color: var(--status-retracted-color); color: var(--status-retracted-color); background: var(--status-retracted-bg); }

/* Uploads/Attachments Container */
.attachment-card {
    text-align: center;
}

.attachment-preview {
    margin-top: 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
    max-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.attachment-preview img {
    max-width: 100%;
    max-height: 280px;
    object-fit: contain;
    border-radius: 4px;
    cursor: pointer;
    transition: var(--transition);
}

.attachment-preview img:hover {
    transform: scale(1.02);
}

.pdf-preview-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
    padding: 2rem;
}

.pdf-preview-box svg {
    width: 48px;
    height: 48px;
    color: #f87171;
}

/* Modal Dialog */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    animation: modalSlide 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlide {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.5rem;
}

/* Responsive Constraints for Admin */
@media (max-width: 992px) {
    .ticket-detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }
    
    .admin-main {
        margin-left: 0;
        padding: 1rem;
    }
}
