/* EIBO CRM - Complete Stylesheet */

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

:root {
    --primary-color: #3b82f6;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --dark-color: #1f2937;
    --light-color: #f9fafb;
    --border-color: #e5e7eb;
    --text-color: #374151;
    --sidebar-width: 260px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--light-color);
    color: var(--text-color);
    line-height: 1.6;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

.login-header i {
    font-size: 48px;
    margin-bottom: 15px;
}

.login-header h1 {
    font-size: 28px;
    margin-bottom: 5px;
}

.login-header p {
    font-size: 14px;
    opacity: 0.9;
}

.login-form {
    padding: 30px;
}

.login-footer {
    padding: 0 30px 30px;
    text-align: center;
    color: #6b7280;
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--dark-color);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    padding: 10px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

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

.nav-item i {
    margin-right: 12px;
    width: 20px;
}

/* Submenu Navigation */
.nav-group {
    margin-bottom: 4px;
}

.nav-parent {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.nav-parent-content {
    display: flex;
    align-items: center;
    flex: 1;
}

.nav-arrow {
    font-size: 12px;
    margin-right: 20px;
    transition: transform 0.3s;
}

.nav-parent.open .nav-arrow {
    transform: rotate(180deg);
}

.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(0, 0, 0, 0.2);
}

.nav-parent.open + .nav-submenu {
    max-height: 500px;
}

.nav-subitem {
    display: flex;
    align-items: center;
    padding: 10px 20px 10px 50px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s;
}

.nav-subitem:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-subitem.active {
    background: rgba(59, 130, 246, 0.3);
    color: white;
    border-left: 3px solid var(--primary-color);
}

.nav-subitem i {
    margin-right: 10px;
    width: 18px;
    font-size: 13px;
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.user-info i {
    font-size: 32px;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
}

.btn-logout {
    display: block;
    width: 100%;
    padding: 10px;
    background: rgba(239, 68, 68, 0.2);
    color: white;
    text-align: center;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: var(--danger-color);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    background: var(--light-color);
}

.content-wrapper {
    padding: 30px;
    max-width: 1400px;
}

/* Page Header */
.page-header {
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: 28px;
    color: var(--dark-color);
    margin-bottom: 8px;
}

.page-header p {
    color: #6b7280;
}

.page-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
}

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

.btn-primary:hover {
    background: #2563eb;
}

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

.btn-success:hover {
    background: #059669;
}

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

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

.btn-secondary {
    background: #6b7280;
    color: white;
}

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

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-block {
    width: 100%;
    justify-content: center;
}

/* Cards */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

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

.card-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    background: #f9fafb;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 15px;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

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

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

.stat-icon.orange {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.stat-icon.purple {
    background: rgba(139, 92, 246, 0.1);
    color: var(--secondary-color);
}

.stat-content h4 {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
    margin-bottom: 5px;
}

.stat-content .stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--dark-color);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark-color);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

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

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead {
    background: var(--light-color);
}

table th,
table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

table th {
    font-weight: 600;
    color: var(--dark-color);
}

table tbody tr:hover {
    background: #f9fafb;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-hot {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
}

.badge-warm {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.badge-cold {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
}

.badge-pending {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
}

.badge-cancelled {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-color);
    border-left: 4px solid var(--success-color);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger-color);
    border-left: 4px solid var(--danger-color);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-color);
    border-left: 4px solid var(--warning-color);
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
    border-left: 4px solid var(--primary-color);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h3 {
    font-size: 20px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6b7280;
}

.modal-body {
    padding: 20px;
}

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

/* Search Box */
.search-box {
    position: relative;
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 10px 40px 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.search-box i {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
}

/* Pipeline Board */
.pipeline-board {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 20px;
}

.pipeline-column {
    min-width: 280px;
    background: #f3f4f6;
    border-radius: 8px;
    padding: 15px;
}

.pipeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid;
}

.pipeline-header h4 {
    font-size: 14px;
    font-weight: 600;
}

.pipeline-header .count {
    background: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.pipeline-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 100px;
}

.lead-card {
    background: white;
    border-radius: 6px;
    padding: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s;
}

.lead-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.lead-card h5 {
    font-size: 14px;
    margin-bottom: 8px;
}

.lead-card .lead-meta {
    font-size: 12px;
    color: #6b7280;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Chat Interface */
.chat-container {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    height: calc(100vh - 140px);
}

.chat-contacts {
    background: white;
    border-radius: 8px;
    overflow-y: auto;
}

.contact-item {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background 0.3s;
}

.contact-item:hover,
.contact-item.active {
    background: var(--light-color);
}

.contact-item h5 {
    font-size: 14px;
    margin-bottom: 4px;
}

.contact-item p {
    font-size: 12px;
    color: #6b7280;
}

.chat-window {
    background: white;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
}

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

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    max-height: calc(100vh - 280px);
    background: #f0f2f5;
    scroll-behavior: smooth;
}

.message {
    margin-bottom: 15px;
    display: flex;
}

.message.sent {
    justify-content: flex-end;
}

.message-content {
    max-width: 70%;
    padding: 10px 15px;
    border-radius: 8px;
}

.message.received .message-content {
    background: var(--light-color);
}

.message.sent .message-content {
    background: #dcf8c6;
    color: #000;
}

.message-time {
    font-size: 11px;
    color: #6b7280;
    margin-top: 5px;
}

.message.sent .message-time {
    color: #667781;
    text-align: right;
}

.message-content img {
    max-width: 100%;
    border-radius: 8px;
    margin-bottom: 5px;
}

.message-content video {
    max-width: 100%;
    border-radius: 8px;
    margin-bottom: 5px;
}

.message-content .document-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
}

.message-content .document-link:hover {
    background: rgba(0, 0, 0, 0.1);
}

.chat-input {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f0f2f5;
}

.chat-input input[type="text"] {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 14px;
}

.chat-input input[type="file"] {
    display: none;
}

.file-attach-btn {
    background: transparent;
    border: none;
    color: #667781;
    font-size: 20px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
}

.file-attach-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.file-attach-menu {
    display: none;
    position: absolute;
    bottom: 70px;
    left: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 8px;
    z-index: 1000;
}

.file-attach-menu.active {
    display: block;
}

.file-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
    white-space: nowrap;
}

.file-option:hover {
    background: #f0f2f5;
}

.file-option i {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.file-option.image i { color: #9333ea; }
.file-option.video i { color: #dc2626; }
.file-option.document i { color: #2563eb; }

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: var(--primary-color);
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.mobile-menu-toggle:hover {
    background: var(--secondary-color);
    transform: scale(1.05);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

/* Mobile Close Button */
.mobile-close {
    display: none;
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 5px;
    margin-left: auto;
}

/* Mobile Overlay */
.mobile-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s;
}

.mobile-overlay.active {
    opacity: 1;
}

/* Dashboard Grid Layouts */
.dashboard-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.dashboard-activity-chart {
    margin-bottom: 20px;
}

.dashboard-followups {
    margin-top: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    /* Show mobile menu button */
    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Sidebar mobile styles */
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }
    
    .mobile-close {
        display: block;
    }
    
    /* Main content adjustments */
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    
    .content-wrapper {
        padding: 15px;
    }
    
    /* Page header mobile */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        margin-top: 50px;
    }
    
    .page-header h1 {
        font-size: 24px;
    }
    
    .page-actions {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }
    
    .page-actions .btn,
    .page-actions a {
        width: 100%;
        justify-content: center;
    }
    
    /* Stats grid mobile */
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* Dashboard grid mobile */
    .dashboard-grid-2 {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* Cards mobile */
    .card {
        margin-bottom: 15px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .card-header h3 {
        font-size: 16px;
    }
    
    .card-header .btn {
        width: 100%;
    }
    
    /* Tables mobile */
    .table-container {
        overflow-x: auto;
    }
    
    table {
        min-width: 600px;
    }
    
    /* Forms mobile */
    .form-row {
        flex-direction: column;
    }
    
    .form-row .form-group {
        width: 100%;
    }
    
    /* Modal mobile */
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 10px;
    }
    
    /* Chat container mobile */
    .chat-container {
        grid-template-columns: 1fr;
        height: calc(100vh - 200px);
    }
    
    .chat-contacts {
        display: none;
    }
    
    .chat-contacts.mobile-show {
        display: block;
    }
    
    /* Pipeline board mobile */
    .pipeline-board {
        flex-direction: column;
    }
    
    .pipeline-column {
        min-width: 100%;
    }
    
    /* WhatsApp mobile */
    .chat-window {
        width: 100%;
    }
    
    /* Lead detail mobile */
    .card-body > div[style*="grid"] {
        grid-template-columns: 1fr !important;
    }
    
    /* Buttons mobile */
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    /* Extra small devices */
    .page-header h1 {
        font-size: 20px;
    }
    
    .page-header p {
        font-size: 13px;
    }
    
    .stat-card h3 {
        font-size: 28px;
    }
    
    .stat-card h4 {
        font-size: 13px;
    }
    
    .stat-value {
        font-size: 26px !important;
    }
    
    .btn {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .btn-sm {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .card {
        border-radius: 8px;
    }
    
    .card-header h3 {
        font-size: 14px;
    }
    
    .modal-content {
        border-radius: 8px;
    }
    
    /* Make chart containers responsive */
    canvas {
        max-width: 100% !important;
        height: auto !important;
    }
    
    /* Reduce padding on mobile */
    .card-body {
        padding: 15px;
    }
    
    /* Table text size */
    table {
        font-size: 13px;
    }
    
    table th,
    table td {
        padding: 8px 10px;
    }
}
