/* Enhanced Style with Dark Mode Support */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* CSS Variables for Theming */
:root {
    /* Light Mode Colors */
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: #60a5fa;
    --secondary-color: #10b981;
    --secondary-dark: #059669;
    --accent-color: #8b5cf6;

    --background: #f8fafc;
    --surface: #ffffff;
    --surface-hover: #f1f5f9;
    --sidebar-bg: #1e293b;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-light: #cbd5e1;
    --border-color: #e2e8f0;

    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --info: #3b82f6;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Mode Colors */
[data-theme="dark"] {
    --background: #0f172a;
    --surface: #1e293b;
    --surface-hover: #334155;
    --sidebar-bg: #0a0f1a;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-light: #cbd5e1;
    --border-color: #334155;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    transition: var(--transition);
}

/* Container Layout */
.container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Navigation */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, #0a0f1a 100%);
    color: var(--text-light);
    padding: 0;
    box-shadow: var(--shadow-lg);
    flex-shrink: 0;
    position: relative;
    z-index: 100;
}

.dashboard-logo {
    text-align: center;
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.02);
}

.dashboard-logo img {
    border-radius: 8px;
    transition: var(--transition);
}

.dashboard-logo img:hover {
    transform: scale(1.05);
}

.nav-menu {
    list-style: none;
    padding: 16px 0;
}

.nav-menu li {
    padding: 14px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    transition: var(--transition);
    margin: 4px 12px;
    border-radius: 8px;
    font-weight: 500;
    position: relative;
}

.nav-menu li i {
    margin-right: 12px;
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.nav-menu li:hover:not(.active) {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(4px);
}

.nav-menu li.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.nav-menu li.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 70%;
    background: var(--secondary-color);
    border-radius: 0 4px 4px 0;
}

/* Main Content Area */
.content {
    flex-grow: 1;
    padding: 32px;
    overflow-y: auto;
    background: var(--background);
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    background: var(--surface);
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.search-bar {
    display: flex;
    align-items: center;
    background: var(--background);
    border-radius: 8px;
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    flex: 1;
    max-width: 400px;
}

.search-bar:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-bar i {
    color: var(--text-secondary);
    margin-right: 12px;
}

.search-bar input[type="text"] {
    border: none;
    outline: none;
    background: transparent;
    width: 100%;
    font-size: 14px;
    color: var(--text-primary);
}

.search-bar input[type="text"]::placeholder {
    color: var(--text-secondary);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.add-new-btn,
.theme-toggle-btn {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--secondary-dark) 100%);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.add-new-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.theme-toggle-btn {
    background: var(--surface-hover);
    color: var(--text-primary);
    padding: 10px 12px;
    min-width: auto;
}

.theme-toggle-btn:hover {
    background: var(--primary-color);
    color: white;
}

.add-new-btn i {
    margin-right: 6px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: var(--transition);
}

.user-profile:hover {
    background: var(--surface-hover);
}

.user-profile span {
    font-weight: 500;
    color: var(--text-primary);
}

.user-profile i {
    font-size: 28px;
    color: var(--primary-color);
}

/* Page Content */
.page {
    min-height: 70vh;
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h1 {
    margin-bottom: 24px;
    color: var(--text-primary);
    font-weight: 700;
    font-size: 28px;
}

/* Dashboard Stats */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--surface);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 28px;
    color: white;
    margin-right: 20px;
    box-shadow: var(--shadow);
}

.customers-icon {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.deals-icon {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.tasks-icon {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.revenue-icon {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.stat-info h3 {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-info p {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Recent Activity */
.recent-activity {
    background: var(--surface);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.recent-activity h2 {
    font-size: 20px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-item {
    padding: 12px;
    background: var(--background);
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
    transition: var(--transition);
}

.activity-item:hover {
    background: var(--surface-hover);
    transform: translateX(4px);
}

.activity-item i {
    margin-right: 8px;
    color: var(--primary-color);
}

.activity-item span {
    color: var(--text-secondary);
    font-size: 13px;
}

.no-data {
    color: var(--text-secondary);
    text-align: center;
    padding: 40px 20px;
    font-style: italic;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.add-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.add-btn i {
    margin-right: 6px;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.search-filter {
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 14px;
    flex: 1;
    min-width: 250px;
    transition: var(--transition);
}

.search-filter:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.search-filter i {
    color: var(--text-secondary);
    margin-right: 10px;
}

.search-filter input[type="text"] {
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
    padding: 6px 0;
    flex: 1;
    color: var(--text-primary);
}

.filter-options select {
    padding: 10px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--surface);
    outline: none;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    transition: var(--transition);
}

.filter-options select:hover {
    border-color: var(--primary-color);
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
}

.data-table th,
.data-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--background);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.data-table tbody tr {
    transition: var(--transition);
}

.data-table tbody tr:hover {
    background: var(--surface-hover);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* Status Tags */
.status-tag {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.status-tag.active,
.status-tag.completed,
.status-tag.won {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-tag.inactive,
.status-tag.pending,
.status-tag.potential {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.status-tag.in-progress,
.status-tag.contact,
.status-tag.proposal {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

/* Action Buttons */
.action-btns {
    display: flex;
    gap: 8px;
}

.action-btns button {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    padding: 6px 10px;
    font-size: 14px;
    transition: var(--transition);
    border-radius: 6px;
}

.action-btns button:hover {
    background: rgba(59, 130, 246, 0.1);
}

.action-btns button.delete-btn {
    color: var(--error);
}

.action-btns button.delete-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

.action-btns button.calendar-btn {
    color: var(--warning);
}

.action-btns button.calendar-btn:hover {
    background: rgba(245, 158, 11, 0.1);
}

/* Deals Board (Kanban) */
.deals-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

.deal-column {
    background: var(--background);
    border-radius: 12px;
    padding: 16px;
    min-height: 400px;
    border: 2px solid var(--border-color);
}

.deal-column h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 3px solid var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.deal-column h3 .deal-count {
    background: var(--primary-color);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
}

.deal-list {
    min-height: 350px;
}

.deal-card {
    background: var(--surface);
    border-left: 4px solid var(--primary-color);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    cursor: grab;
    transition: var(--transition);
    border: 1px solid var(--border-color);
}

.deal-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.deal-card:active {
    cursor: grabbing;
    transform: rotate(2deg);
}

.deal-card h4 {
    font-size: 16px;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
}

.deal-card p {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.deal-card .deal-value {
    font-weight: 700;
    color: var(--secondary-color);
    margin-top: 8px;
    font-size: 16px;
}

/* Reports */
.reports-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
}

.report-card {
    background: var(--surface);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.report-card h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 12px;
}

.chart-container {
    height: 300px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease-in;
}

.modal-content {
    background: var(--surface);
    margin: 3% auto;
    padding: 0;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 600px;
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border-color);
    padding: 20px 24px;
    background: var(--background);
    border-radius: 16px 16px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 20px;
}

.close-modal {
    color: var(--text-secondary);
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.close-modal:hover {
    color: var(--error);
    background: rgba(239, 68, 68, 0.1);
}

.modal-body {
    padding: 24px;
}

/* Loading Spinner */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
    display: none;
    /* hidden by default */
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--surface);
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    box-shadow: var(--shadow-lg);
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    background: var(--background);
    color: var(--text-primary);
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group textarea {
    min-height: 100px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    border-top: 2px solid var(--border-color);
    padding-top: 20px;
}

.save-btn,
.cancel-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    font-size: 14px;
}

.save-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

.save-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.cancel-btn {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.cancel-btn:hover {
    background: var(--border-color);
}

/* SWOT Analysis */
#swot-modal .modal-content {
    max-width: 900px;
}

.swot-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.swot-box {
    border: 2px solid var(--border-color);
    padding: 16px;
    border-radius: 12px;
    background: var(--background);
}

.swot-box h3 {
    margin-top: 0;
    font-size: 16px;
    padding-bottom: 8px;
    margin-bottom: 12px;
    font-weight: 600;
    border-bottom: 2px dashed var(--border-color);
}

.swot-box:nth-child(1) {
    border-color: var(--success);
}

.swot-box:nth-child(1) h3 {
    color: var(--success);
}

.swot-box:nth-child(2) {
    border-color: var(--error);
}

.swot-box:nth-child(2) h3 {
    color: var(--error);
}

.swot-box:nth-child(3) {
    border-color: var(--primary-color);
}

.swot-box:nth-child(3) h3 {
    color: var(--primary-color);
}

.swot-box:nth-child(4) {
    border-color: var(--warning);
}

.swot-box:nth-child(4) h3 {
    color: var(--warning);
}

.swot-box textarea {
    height: 150px;
    border: none;
    background: var(--surface);
}

/* Loading Spinner */
.loading-spinner {
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--surface);
    color: var(--text-primary);
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-xl);
    border-left: 4px solid var(--primary-color);
    z-index: 2000;
    animation: slideInRight 0.3s ease-out;
    max-width: 350px;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--error);
}

.toast.warning {
    border-left-color: var(--warning);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .deals-board {
        grid-template-columns: repeat(2, 1fr);
    }

    .reports-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
    }

    .dashboard-logo {
        display: none;
    }

    .nav-menu {
        display: flex;
        justify-content: space-around;
        padding: 0;
    }

    .nav-menu li {
        padding: 12px 8px;
        flex-grow: 1;
        text-align: center;
        justify-content: center;
        flex-direction: column;
        margin: 0;
        border-radius: 0;
        font-size: 12px;
    }

    .nav-menu li i {
        margin-right: 0;
        margin-bottom: 4px;
        font-size: 20px;
    }

    .nav-menu li.active::before {
        display: none;
    }

    .nav-menu li.active {
        border-bottom: 3px solid var(--secondary-color);
        border-radius: 0;
    }

    .content {
        padding: 20px 16px;
    }

    header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .search-bar {
        max-width: 100%;
    }

    .user-info {
        justify-content: space-between;
    }

    .dashboard-stats,
    .reports-container {
        grid-template-columns: 1fr;
    }

    .deals-board {
        grid-template-columns: 1fr;
    }

    .swot-container {
        grid-template-columns: 1fr;
    }

    .deal-column {
        min-height: 250px;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
    }

    .filter-bar {
        flex-direction: column;
    }

    .search-filter {
        min-width: 100%;
    }
}

/* Print Styles */
@media print {

    .sidebar,
    header,
    .add-btn,
    .action-btns,
    .theme-toggle-btn {
        display: none !important;
    }

    .content {
        padding: 0;
    }

    .stat-card,
    .table-container,
    .report-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}