/* Premium SaaS UI Styling Framework - Vanilla CSS */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-main: #0B0F19;
    --bg-card: rgba(17, 24, 39, 0.7);
    --bg-card-hover: rgba(26, 36, 56, 0.9);
    --border-color: rgba(255, 255, 255, 0.08);
    --color-primary: #10B981; /* WhatsApp Emerald */
    --color-primary-hover: #059669;
    --color-primary-glow: rgba(16, 185, 129, 0.15);
    --color-secondary: #3B82F6; /* Developer Blue */
    --color-text-main: #F3F4F6;
    --color-text-muted: #9CA3AF;
    --color-text-dark: #1F2937;
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --glass-blur: blur(12px);
    --sidebar-width: 260px;
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.08) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--color-text-main);
    font-family: var(--font-sans);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

/* Typography and Headings */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #FFFFFF;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: var(--transition-smooth);
}
a:hover {
    color: var(--color-primary-hover);
}

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

/* Sidebar Navigation */
.app-sidebar {
    width: var(--sidebar-width);
    background: rgba(10, 15, 26, 0.85);
    border-right: 1px solid var(--border-color);
    backdrop-filter: var(--glass-blur);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 3rem;
}

.logo-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
    color: white;
    box-shadow: 0 0 20px var(--color-primary-glow);
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 800;
    background: linear-gradient(to right, #FFFFFF, #E5E7EB);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.menu-item a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    color: var(--color-text-muted);
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.menu-item a:hover {
    color: white;
    background: rgba(255, 255, 255, 0.03);
}

.menu-item.active a {
    color: white;
    background: linear-gradient(90deg, var(--color-primary-glow), transparent);
    border-left: 3px solid var(--color-primary);
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

.user-badge {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

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

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

.user-name {
    font-weight: 600;
    color: white;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.user-email {
    color: var(--color-text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.btn-logout {
    width: 100%;
    background: none;
    border: 1px solid var(--border-color);
    padding: 0.6rem;
    border-radius: 8px;
    color: var(--color-text-muted);
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: var(--transition-smooth);
}

.btn-logout:hover {
    color: #EF4444;
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.2);
}

/* Main Content Area */
.app-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 2.5rem;
    min-height: 100vh;
    min-width: 0;
}

/* UI Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2rem;
    backdrop-filter: var(--glass-blur);
    margin-bottom: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: var(--transition-smooth);
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}

.card-title {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

/* Premium Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    border: none;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

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

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

.btn-blue {
    background: var(--color-secondary);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

.btn-blue:hover {
    background: #2563EB;
    transform: translateY(-2px);
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

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

.form-control {
    width: 100%;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.8rem 1rem;
    color: white;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2rem;
    padding-right: 2.5rem;
}

/* Alert Boxes */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.25);
    color: #34D399;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #F87171;
}

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

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

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

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

/* Developer Settings & Snippets */
.code-block-wrapper {
    position: relative;
    margin-top: 1rem;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.code-block-header {
    background: rgba(255, 255, 255, 0.03);
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

pre {
    background: #060913;
    padding: 1.25rem;
    font-family: "Fira Code", "Courier New", Courier, monospace;
    font-size: 0.85rem;
    color: #34D399;
    overflow-x: auto;
    margin: 0;
}

.copy-btn {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 600;
    transition: var(--transition-smooth);
}

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

/* Auth Screens */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--bg-main);
    background-image: 
        radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.1) 0px, transparent 50%);
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: rgba(17, 24, 39, 0.75);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2.5rem;
    backdrop-filter: var(--glass-blur);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    color: white;
    font-weight: 800;
    font-size: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 0 25px var(--color-primary-glow);
}

.auth-title {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

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

.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

/* Chat Layout Specific Styles */
.chat-dashboard {
    height: calc(100vh - 5rem);
    display: flex;
    background: rgba(10, 15, 26, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    overflow: hidden;
    backdrop-filter: var(--glass-blur);
}

.chat-sidebar {
    width: 320px;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    background: rgba(17, 24, 39, 0.5);
}

.chat-sidebar-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.chat-search-wrapper {
    position: relative;
    margin-top: 0.75rem;
}

.contacts-list {
    flex: 1;
    overflow-y: auto;
}

.contact-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    cursor: pointer;
    transition: var(--transition-smooth);
}

.contact-card:hover {
    background: rgba(255, 255, 255, 0.02);
}

.contact-card.active {
    background: rgba(16, 185, 129, 0.08);
    border-left: 3px solid var(--color-primary);
}

.contact-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1F2937, #374151);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    font-size: 1.1rem;
    position: relative;
}

.contact-badge {
    position: absolute;
    top: 0;
    right: 0;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.contact-details {
    flex: 1;
    min-width: 0;
}

.contact-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.25rem;
}

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

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

.contact-last-msg {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Chat Main Pane */
.chat-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #080C14;
    background-image: 
        radial-gradient(circle at 50% 50%, rgba(16, 185, 129, 0.02) 0%, transparent 60%);
    position: relative;
}

.chat-pane-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(17, 24, 39, 0.4);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.active-contact-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: white;
}

.active-contact-phone {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    margin-top: 0.1rem;
}

.messages-pane {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--color-text-muted);
    text-align: center;
    padding: 3rem;
}

.chat-placeholder-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.05);
    color: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(16, 185, 129, 0.1);
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.05);
}

.chat-placeholder-title {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: white;
}

/* Chat Message Bubbles */
.message-bubble-wrapper {
    display: flex;
    width: 100%;
    margin-bottom: 0.25rem;
}

.message-bubble-wrapper.inbound {
    justify-content: flex-start;
}

.message-bubble-wrapper.outbound {
    justify-content: flex-end;
}

.message-bubble {
    max-width: 60%;
    padding: 0.8rem 1.1rem;
    border-radius: 16px;
    font-size: 0.95rem;
    position: relative;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    line-height: 1.45;
}

.message-bubble-wrapper.inbound .message-bubble {
    background: #1F2937;
    color: var(--color-text-main);
    border-bottom-left-radius: 4px;
}

.message-bubble-wrapper.outbound .message-bubble {
    background: #059669; /* Rich Emerald */
    color: white;
    border-bottom-right-radius: 4px;
}

.message-meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 0.35rem;
}

.message-bubble-wrapper.inbound .message-meta {
    color: var(--color-text-muted);
}

.msg-status-icon {
    font-size: 0.8rem;
}

.msg-status-icon.read {
    color: #38BDF8; /* Blue ticks */
}

/* Chat Footer / Input Form */
.chat-pane-footer {
    padding: 1.25rem 1.5rem;
    background: rgba(10, 15, 26, 0.8);
    border-top: 1px solid var(--border-color);
}

.chat-input-form {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.chat-input-form .form-control {
    flex: 1;
    border-radius: 24px;
    padding: 0.85rem 1.5rem;
}

.btn-send {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    transition: var(--transition-smooth);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-send:hover {
    background: var(--color-primary-hover);
    transform: scale(1.05);
}

/* Quick Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: rgba(17, 24, 39, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    backdrop-filter: var(--glass-blur);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.green {
    background: rgba(16, 185, 129, 0.1);
    color: var(--color-primary);
}

.stat-icon.blue {
    background: rgba(59, 130, 246, 0.1);
    color: var(--color-secondary);
}

.stat-icon.purple {
    background: rgba(139, 92, 246, 0.1);
    color: #8B5CF6;
}

.stat-icon.yellow {
    background: rgba(245, 158, 11, 0.1);
    color: #F59E0B;
}

.stat-details {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}
