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

body {
    font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f4f4f4;
    color: #161616;
    line-height: 1.5;
}

/* Layout */
.top-bar {
    background: linear-gradient(135deg, #0F62FE 0%, #0072C3 100%);
    color: white;
    padding: 0 32px;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    justify-content: space-between;
}

.top-bar:has(.nav) {
    justify-content: flex-start;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: white;
    color: #0F62FE;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
}

.logo {
    font-size: 20px;
    font-weight: 600;
    color: white;
    text-decoration: none;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 32px;
}

/* Page Headers */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-title {
    font-size: 28px;
    font-weight: 600;
    color: #161616;
}

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

/* Navigation */
.nav {
    display: flex;
    gap: 8px;
    flex: 1;
}

.nav-link {
    padding: 8px 16px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 14px;
    border-radius: 6px;
    transition: all 0.2s;
    font-weight: 500;
}

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

.nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

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

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #0F62FE;
    transition: all 0.2s;
}

.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

.stat-card:nth-child(2) {
    border-left-color: #24A148;
}

.stat-card:nth-child(3) {
    border-left-color: #FF832B;
}

.stat-card:nth-child(4) {
    border-left-color: #8A3FFC;
}

.stat-label {
    font-size: 13px;
    color: #525252;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: #161616;
}

/* Section Titles */
.section-title {
    font-size: 14px;
    font-weight: 600;
    color: #525252;
    margin-bottom: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e0e0e0;
}

/* Cards (Generic) */
.card {
    background: white;
    border-radius: 8px;
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    /* Added to contain tables */
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #161616;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: #0F62FE;
    color: white;
}

.btn-primary:hover {
    background: #0353e9;
    box-shadow: 0 2px 8px rgba(15, 98, 254, 0.3);
}

.btn-secondary {
    background: white;
    color: #161616;
    border: 2px solid #e0e0e0;
}

.btn-secondary:hover {
    border-color: #0F62FE;
    color: #0F62FE;
}

.back-btn {
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    margin-left: auto;
}

.back-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.action-btn {
    padding: 6px 14px;
    border: none;
    background: transparent;
    color: #0F62FE;
    cursor: pointer;
    font-size: 14px;
    border-radius: 4px;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 500;
    transition: all 0.2s;
}

.action-btn:hover {
    background: #edf5ff;
}

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

.search-input {
    width: 100%;
    max-width: 400px;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'IBM Plex Sans', sans-serif;
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: #0F62FE;
    box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.1);
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    padding: 16px;
    font-size: 13px;
    font-weight: 600;
    color: #525252;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f4f4f4;
    border-bottom: 2px solid #e0e0e0;
}

.table td {
    padding: 16px;
    border-bottom: 1px solid #f4f4f4;
    font-size: 14px;
}

.table tr:hover {
    background: #f9f9f9;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 32px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-title {
    font-size: 22px;
    font-weight: 600;
    margin-bottom: 24px;
    color: #161616;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 2px solid #f4f4f4;
}

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

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #161616;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'IBM Plex Sans', sans-serif;
    transition: all 0.2s;
}

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

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #0F62FE;
    box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Helpers */
.breadcrumb {
    font-size: 13px;
    color: #525252;
    margin-bottom: 16px;
}

.breadcrumb a {
    color: #0F62FE;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    /* Changed from 12px to match table badge size */
    font-weight: 600;
}

.badge-active {
    background: #d1fae5;
    color: #065f46;
}

.badge-lead {
    background: #dbeafe;
    color: #1e40af;
}

.badge-inactive {
    background: #f4f4f4;
    color: #525252;
}

/* Product Badges (from clients.html) */
.product-badge {
    background: linear-gradient(135deg, #0F62FE, #0072C3);
    color: white;
}

.product-badge:nth-child(2) {
    background: linear-gradient(135deg, #8A3FFC, #6929C4);
}

.product-badge:nth-child(3) {
    background: linear-gradient(135deg, #FF832B, #EF6820);
}

.product-badge:nth-child(4) {
    background: linear-gradient(135deg, #24A148, #198038);
}

/* Priority Badges (from activities.html) */
.badge-high {
    background: #DA1E28;
    color: white;
}

.badge-medium {
    background: #FF832B;
    color: white;
}

.badge-low {
    background: #24A148;
    color: white;
}

/* Loading Spinner */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    flex-direction: column;
}

.loading.show {
    display: flex;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e0e0e0;
    border-top-color: #0F62FE;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #525252;
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #161616;
}

.empty-state p {
    color: #525252;
    margin-bottom: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 24px 20px;
    }

    .nav {
        display: none;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .stats,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .table {
        font-size: 13px;
    }

    .table th,
    .table td {
        padding: 12px 8px;
    }

    /* Specifics */
    .deals-grid {
        grid-template-columns: 1fr;
    }
}

/* Global Toast Notification */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: white;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    display: none;
    align-items: center;
    gap: 12px;
    z-index: 2000;
    border-left: 4px solid #24A148;
    max-width: 400px;
    animation: slideIn 0.3s ease-out;
}

.toast.show {
    display: flex;
}

.toast.error {
    border-left-color: #DA1E28;
}

.toast.info {
    border-left-color: #0F62FE;
}

.toast.warning {
    border-left-color: #F1C21B;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}