:root {
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #ec4899;
    --glass-border: rgba(255, 255, 255, 0.1);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
}

.app-container {
    display: flex;
    height: 100vh;
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.15), transparent),
                radial-gradient(circle at bottom left, rgba(236, 72, 153, 0.1), transparent);
}

/* Sidebar Styling */
.sidebar {
    width: 280px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 3rem;
    background: linear-gradient(to right, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    transition: var(--transition);
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* Main Content Area */
.main-content {
    flex: 1;
    padding: 2rem 3rem;
    overflow-y: auto;
    position: relative;
}

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

.page-title h1 {
    font-size: 2rem;
    font-weight: 700;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Cards & Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 1.5rem;
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-5px);
    border-color: rgba(99, 102, 241, 0.3);
}

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

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

input, textarea, select {
    width: 100%;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 12px 16px;
    color: white;
    outline: none;
    transition: var(--transition);
}

input:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.btn {
    padding: 12px 24px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-main);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Modal Styling */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    width: 100%;
    max-width: 450px;
    background: #1e293b;
    padding: 2.5rem;
    border-radius: 28px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Activity Log */
.activity-log {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.log-item {
    display: flex;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition);
    animation: slideInLeft 0.3s ease-out;
}

.log-item:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(5px);
    border-color: rgba(99, 102, 241, 0.2);
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.log-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.log-icon.text { background: rgba(99, 102, 241, 0.1); color: var(--primary); }
.log-icon.media { background: rgba(236, 72, 153, 0.1); color: var(--accent); }

.log-info { flex: 1; }
.log-header { display: flex; justify-content: space-between; margin-bottom: 4px; }
.log-number { font-weight: 600; font-size: 0.9rem; }
.log-time { font-size: 0.75rem; color: var(--text-muted); }
.log-content { font-size: 0.85rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }

/* CRM Table Styling */
.crm-table {
    width: 100%;
    border-collapse: collapse;
}

.crm-table th {
    text-align: left;
    padding: 12px;
    color: var(--text-muted);
    font-weight: 500;
    border-bottom: 1px solid var(--glass-border);
}

.crm-table td {
    padding: 16px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Media Upload UI */
.upload-area {
    border: 2px dashed var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.upload-area:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

/* WhatsApp-Style Chat UI */
.chat-container {
    display: flex;
    height: calc(100vh - 150px);
    background: rgba(15, 23, 42, 0.4);
    border-radius: 24px;
    border: 1px solid var(--glass-border);
    overflow: hidden;
    margin-top: 20px;
}

.chat-list {
    width: 350px;
    border-right: 1px solid var(--glass-border);
    background: rgba(15, 23, 42, 0.6);
    display: flex;
    flex-direction: column;
}

.chat-list-header {
    padding: 20px;
    border-bottom: 1px solid var(--glass-border);
}

.chat-search {
    width: 100%;
    padding: 10px 15px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: white;
    font-size: 0.9rem;
}

.chat-items {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    display: flex;
    padding: 15px 20px;
    gap: 15px;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

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

.chat-item.active {
    background: rgba(99, 102, 241, 0.1);
    border-left: 4px solid var(--primary);
}

.chat-item-info {
    flex: 1;
    min-width: 0;
}

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

.chat-item-name {
    font-weight: 600;
    font-size: 0.95rem;
}

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

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

.chat-window {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: url('https://user-images.githubusercontent.com/15075759/28719144-86dc0f70-73b1-11e7-911d-60d70fcded21.png');
    background-blend-mode: overlay;
    background-color: var(--bg-dark);
}

.chat-header {
    padding: 15px 25px;
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 15px;
}

.chat-messages {
    flex: 1;
    padding: 25px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.msg {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.95rem;
    position: relative;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.msg-received {
    align-self: flex-start;
    background: #1e293b;
    color: white;
    border-bottom-left-radius: 4px;
}

.msg-sent {
    align-self: flex-end;
    background: #4338ca;
    color: white;
    border-bottom-right-radius: 4px;
}

.msg-time {
    font-size: 0.7rem;
    opacity: 0.6;
    margin-top: 5px;
    text-align: right;
}

.chat-input-area {
    padding: 20px;
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--glass-border);
    display: flex;
    gap: 15px;
    align-items: center;
}

.chat-input {
    flex: 1;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--glass-border);
    padding: 12px 20px;
    border-radius: 25px;
    color: white;
    outline: none;
}
