/* WhatsMan Dashboard Design System */

* {
    box-sizing: border-box;
}

:root {
    --primary: #00b289;
    --navy: #1a4d4a;
    --bg-light: #f0f7f7;
    --white: #FFFFFF;
    --gray-text: #64748B;
    --dark-text: #0F172A;
    --border-color: #E2E8F0;
    --radius-lg: 15px;
    --radius-md: 10px;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.05);
}

body {
    font-family: 'DM Sans', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-light);
    color: var(--dark-text);
    -webkit-font-smoothing: antialiased;
}

.container {
    width: 100%;
    min-height: 100vh;
}

/* Generic Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
}
th {
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
}
td {
    padding: 16px 24px;
    font-size: 15px;
    color: var(--dark-text);
    border-bottom: 1px solid var(--border-color);
}

/* Button Redesign */
.btn {
    background-color: var(--primary);
    color: var(--white);
    border: none;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    gap: 8px;
}
.btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 178, 137, 0.3);
}
.btn-secondary {
    background-color: var(--white);
    color: var(--dark-text);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background-color: #F8FAFC;
}

/* Input Styles */
input, select, textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    background: var(--white);
    transition: border-color 0.2s;
}
/* Enhanced Labels, Checkboxes and Progress Bars */
label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--navy);
    margin-bottom: 8px;
}

input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
    vertical-align: middle;
}

progress {
    width: 100%;
    height: 12px;
    appearance: none;
    border-radius: 99px;
    overflow: hidden;
    margin: 8px 0;
}
progress::-webkit-progress-bar {
    background-color: #E2E8F0;
}
progress::-webkit-progress-value {
    background-color: var(--primary);
}
progress::-moz-progress-bar {
    background-color: var(--primary);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(0, 178, 137, 0.1);
}

/* Badge Styles */
.badge {
    display: inline-flex;
    padding: 4px 12px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}
.badge.success { background: #DCFCE7; color: #166534; }
.badge.warning { background: #FEF9C3; color: #854D0E; }
.badge.error { background: #FEE2E2; color: #991B1B; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* Dashboard Internal Styles */
.dashboard-container { display: flex; min-height: 100vh; background: var(--bg-light); }
.sidebar { 
    width: 260px; 
    background: var(--navy); 
    color: var(--white); 
    display: flex; 
    flex-direction: column; 
    flex-shrink: 0; 
    position: sticky; 
    top: 0; 
    height: 100vh; 
    z-index: 100; 
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-x: hidden;
    overflow-y: auto;
}
.sidebar.collapsed { width: 80px; }

.sidebar-header { 
    padding: 24px; 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    position: relative;
    min-height: 80px;
}
.sidebar-logo { 
    width: 32px; 
    height: 32px; 
    background: var(--primary); 
    border-radius: 8px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-weight: 800; 
    font-size: 18px; 
    color: white; 
    flex-shrink: 0;
}
.sidebar-brand { 
    font-size: 20px; 
    font-weight: 700; 
    letter-spacing: -0.02em; 
    white-space: nowrap;
    transition: opacity 0.2s;
    color: var(--primary);
}
.sidebar.collapsed .sidebar-brand { opacity: 0; pointer-events: none; }

.collapse-toggle {
    position: absolute;
    right: -12px;
    top: 32px;
    width: 24px;
    height: 24px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    box-shadow: var(--shadow-sm);
    z-index: 101;
    border: 2px solid var(--navy);
    transition: transform 0.3s;
}
.sidebar.collapsed .collapse-toggle { transform: rotate(180deg); right: 28px; top: 70px; }

.sidebar-menu { padding: 0 16px; flex-grow: 1; }
.menu-label { 
    font-size: 11px; 
    font-weight: 700; 
    text-transform: uppercase; 
    letter-spacing: 0.1em; 
    color: rgba(255, 255, 255, 0.4); 
    margin: 24px 0 12px 12px;
    white-space: nowrap;
    transition: opacity 0.2s;
}
.sidebar.collapsed .menu-label { opacity: 0; }

.nav-item { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    padding: 12px 16px; 
    color: rgba(255, 255, 255, 0.7); 
    text-decoration: none; 
    border-radius: var(--radius-md); 
    font-size: 15px; 
    font-weight: 500; 
    transition: all 0.2s ease; 
    margin-bottom: 4px;
    white-space: nowrap;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.05); color: var(--white); }
.nav-item.active { background: var(--primary); color: var(--white); box-shadow: 0 4px 12px rgba(0, 178, 137, 0.3); }
.nav-item svg { width: 22px; height: 22px; opacity: 0.7; flex-shrink: 0; }
.nav-item.active svg { opacity: 1; }
.nav-item span { transition: opacity 0.2s; }
.sidebar.collapsed .nav-item span { opacity: 0; width: 0; overflow: hidden; }
.sidebar.collapsed .nav-item { padding: 12px; justify-content: center; gap: 0; }

.main-wrapper { flex-grow: 1; display: flex; flex-direction: column; min-width: 0; }
.header { height: 80px; background: var(--white); border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; padding: 0 40px; position: sticky; top: 0; z-index: 90; }
.header-search { position: relative; width: 100%; max-width: 400px; }
.header-search input { padding-left: 44px; background: #F8FAFC; border-radius: 99px; border: 1px solid transparent; }
.header-search svg { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--gray-text); }
.content-body { padding: 40px; }
.card { background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 32px; margin-bottom: 32px; }
.page-title { font-size: 28px; font-weight: 800; margin: 0 0 8px 0; letter-spacing: -0.02em; }
.page-desc { color: var(--gray-text); font-size: 15px; margin-bottom: 32px; }

/* Table Styles */
.table-container { background: var(--white); border-radius: var(--radius-lg); border: 1px solid var(--border-color); overflow: hidden; }
.table-header { padding: 24px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }
.table-footer { padding: 16px 24px; background: #F8FAFC; border-top: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; }

/* Pill System */
.pill-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    border: 1px solid var(--border-color);
    padding: 12px;
    border-radius: var(--radius-md);
    min-height: 48px;
    background: #F8FAFC;
    margin-bottom: 24px;
    align-items: center;
    position: relative;
    cursor: text;
    transition: all 0.2s;
}
.pill-container:focus-within {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 178, 137, 0.1);
}
.pill {
    background: var(--primary);
    color: white;
    padding: 6px 14px;
    border-radius: 99px;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 2px 4px rgba(0, 178, 137, 0.2);
}
.pill .remove {
    cursor: pointer;
    font-weight: 800;
    opacity: 0.8;
}
.pill .remove:hover { opacity: 1; }
.pill-input {
    flex: 1;
    min-width: 150px;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
    font-size: 14px;
    padding: 0 !important;
    margin: 0 !important;
}

/* Autocomplete Dropdown */
.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: none;
    max-height: 250px;
    overflow-y: auto;
    padding: 8px;
}

.autocomplete-item {
    padding: 10px 14px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.autocomplete-item:hover { background: #F1F5F9; }
.autocomplete-item strong { color: var(--navy); font-size: 14px; }
.autocomplete-item span { font-size: 11px; color: var(--gray-text); font-family: monospace; }

/* Modal Overlay */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6); backdrop-filter: blur(4px); z-index: 1000; align-items: center; justify-content: center; }
.modal { background: white; padding: 32px; border-radius: var(--radius-lg); width: 100%; max-width: 440px; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25); }

/* Auth & Landing Layout */
.auth-container { width: 100%; min-height: 100vh; background: var(--bg-light); }
.auth-container .content-body { padding: 0; }
.auth-container .main-wrapper { min-height: 100vh; display: flex; align-items: stretch; }

.profile-info { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.avatar { width: 40px; height: 40px; background: #E2E8F0; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; color: var(--primary); }

/* Toast Notification System */
.toast-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
    width: auto;
    min-width: 320px;
}
.toast {
    position: relative;
    background: #1e293b;
    color: white;
    padding: 16px 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    animation: toastIn 0.3s ease-out forwards;
    pointer-events: auto;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.1);
}
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    background: var(--primary);
    width: 100%;
    transform-origin: left;
    animation: toastProgress linear forwards;
}
@keyframes toastIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes toastProgress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    /* Layout */
    .dashboard-container { flex-direction: column; }
    
    /* Sidebar */
    .sidebar { width: 100%; height: auto; position: static; }
    .sidebar.collapsed { width: 100%; height: 80px; overflow: hidden; }
    .collapse-toggle { top: 20px; right: 20px; }
    .sidebar.collapsed .collapse-toggle { top: 20px; right: 20px; transform: rotate(180deg); }
    .sidebar-header { padding: 16px; min-height: 80px; }
    
    /* Header & Main */
    .header { padding: 0 16px; height: 60px; overflow: hidden; }
    .content-body { padding: 16px; overflow-x: hidden; }
    
    /* Search box on mobile */
    .header-search { display: none; }
    
    /* Page Typography */
    .page-title { font-size: 24px; }
    
    /* Tables */
    .table-container { overflow-x: auto; display: block; width: 100%; -webkit-overflow-scrolling: touch; }
    table { min-width: 600px; } /* Ensures scroll on small devices */
    th, td { padding: 12px 16px; font-size: 13px; white-space: nowrap; }
    
    /* Modals & Cards */
    .card { padding: 16px; margin-bottom: 20px; flex-direction: column; align-items: stretch; gap: 12px; }
    .card .header-search { display: block; max-width: 100%; }
    .modal { padding: 20px; margin: 16px; width: calc(100% - 32px); height: max-content; }
    
    /* Auth layout */
    .auth-container .main-wrapper { padding: 16px; }
    .auth-container .card { margin: 20px 0; }
    
    /* Utilities */
    .btn { font-size: 14px; padding: 10px 16px; }
    .table-header { flex-direction: column; align-items: flex-start; gap: 12px; }
}
