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

:root {
    --bg-main: #0b0f19;
    --bg-surface: rgba(17, 24, 39, 0.8);
    --bg-card: rgba(31, 41, 55, 0.45);
    --bg-chat-customer: rgba(55, 65, 81, 0.6);
    --bg-chat-agent: rgba(0, 168, 132, 0.25);
    --border-color: rgba(255, 255, 255, 0.07);
    --border-active: rgba(0, 168, 132, 0.5);
    
    --primary: #00a884;
    --primary-hover: #008f70;
    --primary-glow: rgba(0, 168, 132, 0.35);
    
    --secondary: #3b82f6;
    --accent: #f43f5e;
    --accent-glow: rgba(244, 63, 94, 0.2);
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dark: #111827;
    
    --glass-blur: blur(16px);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Plus Jakarta Sans', 'Outfit', sans-serif;
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(at 10% 20%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 90% 10%, rgba(0, 168, 132, 0.12) 0px, transparent 50%),
        radial-gradient(at 50% 80%, rgba(244, 63, 94, 0.08) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 10px var(--primary-glow); }
    50% { box-shadow: 0 0 20px rgba(0, 168, 132, 0.6); }
}

/* Layout Utilities */
.app-container {
    display: flex;
    width: 100vw;
    height: 100vh;
    background: transparent;
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
}

/* Login Page Styling */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    backdrop-filter: var(--glass-blur);
    animation: fadeIn 0.6s ease-out;
}

.login-header {
    text-align: center;
    margin-bottom: 35px;
}

.login-logo {
    font-size: 2.2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
    letter-spacing: -1px;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 16px;
    color: var(--text-main);
    font-size: 1rem;
    outline: none;
    transition: var(--transition-smooth);
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
    background: rgba(255, 255, 255, 0.08);
}

.login-btn {
    width: 100%;
    background: var(--primary);
    color: var(--text-main);
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    margin-top: 10px;
}

.login-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 8px 16px var(--primary-glow);
}

.login-error {
    background: rgba(244, 63, 94, 0.15);
    border: 1px solid var(--accent);
    color: #fda4af;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    text-align: center;
}

/* Dashboard Layout */
.dashboard-layout {
    display: flex;
    width: 100%;
    height: 100%;
}

/* Sidebar Styling */
.sidebar {
    width: 350px;
    background: rgba(15, 23, 42, 0.5);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.user-profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info-badge {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
}

.user-details h4 {
    font-size: 0.95rem;
    font-weight: 600;
}

.user-details span {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
}

.logout-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.85rem;
    transition: var(--transition-smooth);
}

.logout-link:hover {
    color: var(--accent);
}

.search-bar-wrapper {
    position: relative;
}

.search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 10px 14px;
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition-smooth);
}

.search-input:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.07);
}

/* Chat list */
.chat-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    display: flex;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    gap: 12px;
}

.chat-item:hover {
    background: rgba(255, 255, 255, 0.02);
}

.chat-item.active {
    background: rgba(0, 168, 132, 0.08);
    border-left: 3px solid var(--primary);
}

.chat-item-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    flex-shrink: 0;
}

.chat-item.active .chat-item-avatar {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.chat-item-content {
    flex: 1;
    min-width: 0; /* Ensures overflow text-overflow works */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.chat-item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 4px;
}

.chat-item-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.chat-item-lastmsg {
    font-size: 0.85rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-item-badge {
    position: absolute;
    right: 20px;
    bottom: 16px;
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* Chat Main View */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(10, 15, 30, 0.4);
    position: relative;
}

.chat-main-placeholder {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex: 1;
    color: var(--text-muted);
    text-align: center;
    gap: 15px;
}

.chat-placeholder-icon {
    font-size: 4rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.chat-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.3);
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.chat-header-meta h3 {
    font-size: 1rem;
    font-weight: 600;
}

.chat-header-meta span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.chat-header-actions {
    display: flex;
    gap: 10px;
}

/* Action Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition-smooth);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-accent {
    background: var(--accent);
    color: white;
}

.btn-accent:hover {
    background: #e11d48;
    box-shadow: 0 4px 12px var(--accent-glow);
}

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

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background-image: radial-gradient(rgba(255,255,255,0.015) 1px, transparent 0);
    background-size: 24px 24px;
}

/* Message Bubbles */
.message-row {
    display: flex;
    width: 100%;
}

.message-row.incoming {
    justify-content: flex-start;
}

.message-row.outgoing {
    justify-content: flex-end;
}

.message-row.system {
    justify-content: center;
}

.message-bubble {
    max-width: 65%;
    padding: 12px 16px;
    border-radius: 16px;
    position: relative;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.message-row.incoming .message-bubble {
    background: var(--bg-chat-customer);
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(255,255,255,0.03);
}

.message-row.outgoing .message-bubble {
    background: var(--bg-chat-agent);
    border-bottom-right-radius: 4px;
    border: 1px solid rgba(0, 168, 132, 0.15);
}

.message-row.system .message-bubble {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    max-width: 80%;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.message-text {
    font-size: 0.92rem;
    line-height: 1.5;
    word-break: break-word;
}

.message-meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 5px;
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Rich media in chats */
.message-media {
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 4px;
    max-width: 320px;
}

.message-media img {
    width: 100%;
    height: auto;
    max-height: 240px;
    object-fit: cover;
    display: block;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.message-media img:hover {
    filter: brightness(0.9);
}

.message-media video {
    width: 100%;
    max-height: 240px;
    background: black;
    display: block;
}

.message-audio {
    width: 250px;
    padding: 4px 0;
}

/* Message Composer Input */
.chat-composer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: rgba(15, 23, 42, 0.4);
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.composer-attachments {
    position: relative;
}

.attachment-trigger {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.attachment-trigger:hover {
    color: var(--primary);
    background: rgba(255,255,255,0.08);
}

.attachment-menu {
    position: absolute;
    bottom: 55px;
    left: 0;
    background: #1e293b;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    padding: 8px;
    display: none;
    flex-direction: column;
    gap: 4px;
    z-index: 10;
    width: 150px;
}

.attachment-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--text-main);
    text-decoration: none;
    font-size: 0.85rem;
    transition: var(--transition-smooth);
    cursor: pointer;
}

.attachment-option:hover {
    background: rgba(255,255,255,0.06);
    color: var(--primary);
}

.composer-input-wrapper {
    flex: 1;
}

.composer-textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    resize: none;
    max-height: 120px;
    height: 44px;
    line-height: 1.4;
    transition: var(--transition-smooth);
}

.composer-textarea:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.07);
}

.composer-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--primary);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    flex-shrink: 0;
}

.composer-send-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--primary-glow);
}

/* Right Sidebar (Stats & Info) */
.info-sidebar {
    width: 320px;
    background: rgba(15, 23, 42, 0.4);
    border-left: 1px solid var(--border-color);
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    flex-shrink: 0;
}

.sidebar-section-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 15px;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: var(--transition-smooth);
}

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

.stat-card-title {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.stat-card-value {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-main);
}

.stat-card-commission {
    font-size: 0.72rem;
    color: var(--primary);
    font-weight: 500;
}

.stats-card-full {
    grid-column: span 2;
    border-left: 3px solid var(--primary);
}

.stats-card-full.accent {
    border-left-color: var(--accent);
}

/* Customer Profile Panel */
.customer-profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    background: rgba(255,255,255,0.02);
    padding: 16px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
}

.customer-profile-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.5rem;
}

.customer-profile-name {
    font-weight: 600;
    font-size: 1.05rem;
}

.customer-profile-phone {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Modals (Book Order, etc.) */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 20px;
}

.modal {
    background: #111827;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s ease-out;
    overflow: hidden;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    line-height: 1;
    transition: var(--transition-smooth);
}

.modal-close:hover {
    color: white;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Admin Dashboard Specific styles */
.admin-grid {
    display: flex;
    flex-direction: column;
    gap: 30px;
    padding: 30px;
    width: 100%;
    height: 100%;
    overflow-y: auto;
}

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

.admin-summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.admin-summary-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.admin-card-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.admin-card-value {
    font-size: 1.75rem;
    font-weight: 700;
}

.admin-section {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.admin-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.admin-section-title {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Responsive Table */
.table-wrapper {
    overflow-x: auto;
    width: 100%;
}

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

.data-table th {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 0.9rem;
}

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

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

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

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

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Badge tags */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
}

.badge-success {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.badge-info {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.tabs-nav {
    display: flex;
    gap: 8px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    margin-bottom: 24px;
}

.tab-btn {
    padding: 8px 16px;
    border-radius: 6px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.tab-btn:hover {
    color: white;
}

.tab-btn.active {
    background: rgba(255,255,255,0.06);
    color: var(--primary);
}

.tab-content {
    display: none;
}

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

/* File Input Wrapper */
.hidden-file-input {
    display: none;
}

/* Delete message hover transition */
.delete-msg-btn:hover {
    color: var(--accent) !important;
}
