/* CRM Core Variables & Reset (Dark Glassmorphism Style) */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@600;700&display=swap');

:root {
    --bg-main: #0f172a;
    --bg-sidebar: #0b1120;
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-column: rgba(15, 23, 42, 0.5);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #d4af37;
    --primary-hover: #b5952f;
    --border: rgba(255, 255, 255, 0.1);
    --danger: #e74c3c;
    --success: #2ecc71;
    --shadow-glow: 0 0 15px rgba(212, 175, 55, 0.2);
    --shadow-md: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    --font-family: 'Inter', sans-serif;
    --header-font: 'Montserrat', sans-serif;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-main);
    overflow: hidden;
}

h1, h2, h3, h4, h5, h6, .card-title {
    font-family: var(--header-font);
}

/* Layout */
.crm-container {
    display: flex;
    height: 100vh;
}

.sidebar {
    width: 250px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

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

.sidebar-header h2 {
    font-size: 1.2rem;
    color: var(--primary);
    font-weight: 700;
    letter-spacing: 1px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 15px 0;
}

.nav-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s;
}

.nav-item svg {
    width: 20px;
    height: 20px;
    color: var(--text-muted);
    transition: color 0.3s;
}

.nav-item:hover, .nav-item.active {
    background-color: var(--glass-bg);
    color: var(--primary);
}

.nav-item.active svg {
    color: var(--primary);
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.top-header {
    height: 60px;
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
}

.top-header h1 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-main);
}

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

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s;
}

.btn-primary {
    background-color: var(--primary);
    color: #0b1120;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(212, 175, 55, 0.4);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
}
.btn-outline:hover, .btn-outline.active-tab {
    background: var(--glass-bg);
    color: var(--primary);
    border-color: var(--primary);
}

.btn-icon {
    background: transparent;
    border: 1px solid var(--glass-border);
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    border-radius: 8px;
}

.btn-icon:hover {
    background-color: var(--glass-bg);
    color: var(--primary);
    border-color: var(--primary);
}

.full-width {
    width: 100%;
}

.content-area {
    flex: 1;
    overflow: auto;
    padding: 24px;
}

.view {
    display: none;
    height: 100%;
}

.view.active {
    display: block;
}

/* Kanban Board */
.kanban-board {
    display: flex;
    gap: 20px;
    height: 100%;
    align-items: flex-start;
    overflow-x: auto;
    padding-bottom: 20px;
}

.kanban-board::-webkit-scrollbar { height: 8px; }
.kanban-board::-webkit-scrollbar-track { background: var(--bg-sidebar); border-radius: 4px; }
.kanban-board::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.kanban-column {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    min-width: 320px;
    width: 320px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    max-height: 100%;
}

.column-header {
    padding: 15px;
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.column-count {
    background: rgba(212, 175, 55, 0.1);
    color: var(--primary);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
}

.column-body {
    padding: 10px;
    flex: 1;
    overflow-y: auto;
    min-height: 100px;
}

.column-body::-webkit-scrollbar { width: 4px; }
.column-body::-webkit-scrollbar-track { background: transparent; }
.column-body::-webkit-scrollbar-thumb { background: var(--border); }

.kanban-card {
    background: var(--bg-card);
    backdrop-filter: blur(8px);
    border: 1px solid var(--glass-border);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    cursor: grab;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.kanban-card:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-glow);
    z-index: 2;
}

.kanban-card:active {
    cursor: grabbing;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.card-id {
    font-size: 0.75rem;
    color: var(--primary);
    font-weight: 700;
    background: rgba(212, 175, 55, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
}

.card-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
}

.card-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.card-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tag {
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.kanban-card.dragging {
    opacity: 0.5;
    transform: scale(0.98);
}

.column-body.drag-over {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
}

/* Modals & Split Layout */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(11, 17, 32, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content.modal-split {
    background: #1e293b;
    border: 1px solid var(--glass-border);
    width: 90%;
    max-width: 900px;
    height: 80vh;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    display: flex;
    overflow: hidden;
}

.modal-left {
    flex: 1;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.modal-right {
    flex: 1;
    background: rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

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

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

.close-modal:hover {
    color: var(--danger);
}

.modal-body {
    padding: 24px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.form-group input, .form-group textarea, .form-select {
    width: 100%;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.form-select {
    appearance: none;
}

.form-select option {
    background: var(--bg-main);
    color: var(--text-main);
}

.form-group input:focus, .form-group textarea:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Chat & Task Area */
.chat-body {
    padding: 0;
}

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

.chat-msg {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 12px;
    border-radius: 8px;
    font-size: 0.9rem;
    line-height: 1.4;
}

.chat-msg.system {
    background: rgba(212, 175, 55, 0.05);
    border-color: rgba(212, 175, 55, 0.2);
    border-left: 3px solid var(--primary);
}

.chat-msg .meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 5px;
    display: flex;
    justify-content: space-between;
}

.chat-input-area {
    padding: 15px;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}

.chat-input-area textarea {
    width: 100%;
    padding: 10px;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: var(--text-main);
    resize: none;
    height: 60px;
    font-family: inherit;
    margin-bottom: 10px;
}

.chat-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.date-input {
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    padding: 6px 10px;
    border-radius: 6px;
    font-family: inherit;
}

/* Event Cards */
.event-card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid var(--primary);
    transition: transform 0.2s, box-shadow 0.2s;
}

.event-card:hover {
    transform: scale(1.01);
    box-shadow: var(--shadow-glow);
}

/* Toasts */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    min-width: 250px;
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(120%);
    animation: slideIn 0.3s forwards;
}

.toast.success { border-left: 4px solid var(--success); }
.toast.error { border-left: 4px solid var(--danger); }
.toast.info { border-left: 4px solid var(--primary); }

.toast.fade-out {
    animation: fadeOut 0.3s forwards;
}

@keyframes slideIn {
    to { transform: translateX(0); }
}

@keyframes fadeOut {
    to { opacity: 0; transform: translateX(120%); }
}
