/* =====================================================
   Solad Admin Pro - Krishna Enterprise
   Custom Styles
   ===================================================== */

:root {
    --primary: #0d6efd;
    --primary-dark: #0a58ca;
    --sidebar-bg: #1a1f2e;
    --sidebar-hover: #2a3042;
    --sidebar-active: #0d6efd;
    --sidebar-text: #a6b0cf;
    --sidebar-width: 260px;
    --header-height: 60px;
    --body-bg: #f3f3f9;
    --card-bg: #ffffff;
    --text-primary: #212529;
    --text-muted: #74788d;
    --border-color: #e9ebec;
    --success: #0ab39c;
    --warning: #f7b84b;
    --danger: #f06548;
    --info: #299cdb;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--body-bg);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* ---- Login Page ---- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1a1f2e 0%, #0d6efd 100%);
}

.login-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.login-card .logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    text-align: center;
    margin-bottom: 8px;
}

.login-card .logo-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 30px;
}

/* ---- Sidebar ---- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1000;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar-brand {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 10px;
    height: var(--header-height);
}

.sidebar-brand .brand-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.sidebar-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 8px;
    background: #fff;
    padding: 3px;
    flex-shrink: 0;
}

.sidebar-brand .brand-name {
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
}

.sidebar-brand .brand-sub {
    color: var(--sidebar-text);
    font-size: 0.7rem;
    display: block;
}

.sidebar-menu {
    padding: 12px 0;
}

.sidebar-menu .menu-label {
    padding: 12px 20px 6px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--sidebar-text);
    font-weight: 600;
}

.sidebar-menu .menu-item {
    display: block;
    padding: 10px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
    border-left: 3px solid transparent;
}

.sidebar-menu .menu-item:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-menu .menu-item.active {
    background: var(--sidebar-hover);
    color: #fff;
    border-left-color: var(--sidebar-active);
}

.sidebar-menu .menu-item i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

/* ---- Top Header ---- */
.top-header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 999;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.top-header .page-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.top-header .header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.powered-by-errorx {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.75rem;
    color: #fff;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    padding: 5px 12px;
    border-radius: 20px;
    text-decoration: none;
    letter-spacing: 0.3px;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.powered-by-errorx:hover {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.powered-by-errorx i {
    font-size: 0.8rem;
}

@media (max-width: 576px) {
    .powered-by-errorx span,
    .powered-by-errorx {
        font-size: 0.65rem;
        padding: 4px 8px;
    }
}

.top-header .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.top-header .user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.top-header .user-name {
    font-size: 0.85rem;
    font-weight: 500;
}

.top-header .user-role-badge {
    font-size: 0.7rem;
    display: block;
    color: var(--text-muted);
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-primary);
}

/* ---- Main Content ---- */
.main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding: 24px;
    min-height: calc(100vh - var(--header-height));
}

/* ---- Stat Cards ---- */
.stat-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid var(--border-color);
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: #fff;
}

.stat-card .stat-icon.bg-primary { background: var(--primary); }
.stat-card .stat-icon.bg-success { background: var(--success); }
.stat-card .stat-icon.bg-warning { background: var(--warning); }
.stat-card .stat-icon.bg-danger { background: var(--danger); }
.stat-card .stat-icon.bg-info { background: var(--info); }

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-top: 12px;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ---- Cards & Tables ---- */
.content-card {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
}

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

.content-card .card-header-custom h5 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.content-card .card-body-custom {
    padding: 20px;
}

.table th {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom-width: 1px !important;
    white-space: nowrap;
}

.table td {
    font-size: 0.875rem;
    vertical-align: middle;
}

/* ---- Status Badges ---- */
.badge-status {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-new { background: #e8f4fd; color: #0d6efd; }
.badge-follow_up { background: #fff3e0; color: #f7b84b; }
.badge-negotiation { background: #f3e5f5; color: #9c27b0; }
.badge-converted { background: #e8f5e9; color: #0ab39c; }
.badge-lost { background: #fbe9e7; color: #f06548; }

/* ---- Buttons ---- */
.btn-action {
    padding: 4px 8px;
    font-size: 0.8rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ---- Form styles ---- */
.form-label {
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 4px;
}

.form-control, .form-select {
    font-size: 0.875rem;
    border-color: var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, 0.15);
}

/* ---- Payment History ---- */
.payment-timeline {
    position: relative;
    padding-left: 30px;
}

.payment-timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.payment-entry {
    position: relative;
    margin-bottom: 20px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid var(--primary);
}

.payment-entry::before {
    content: '';
    position: absolute;
    left: -25px;
    top: 20px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid #fff;
}

.payment-entry .payment-amount {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--success);
}

.payment-entry .payment-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ---- Footer ---- */
.main-footer {
    text-align: center;
    padding: 16px 24px;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    background: var(--card-bg);
    margin-left: var(--sidebar-width);
}

/* ---- Responsive ---- */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .top-header {
        left: 0;
    }

    .main-content {
        margin-left: 0;
    }

    .main-footer {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: block;
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
        display: none;
    }

    .sidebar-overlay.show {
        display: block;
    }
}

/* ---- Misc Utilities ---- */
.text-truncate-custom {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state h5 {
    font-weight: 600;
    margin-bottom: 8px;
}

/* ---- Status Timeline ---- */
.status-timeline {
    position: relative;
    padding-left: 30px;
}

.status-timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.status-entry {
    position: relative;
    margin-bottom: 20px;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 3px solid var(--info);
}

.status-entry.status-created {
    border-left-color: var(--success);
}

.status-entry::before {
    content: '';
    position: absolute;
    left: -25px;
    top: 20px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--info);
    border: 2px solid #fff;
}

.status-entry.status-created::before {
    background: var(--success);
}

.status-entry .status-change {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.status-entry .status-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* ---- Stock Movement Badges ---- */
.badge-in { background: #e8f5e9; color: #0ab39c; }
.badge-out { background: #fbe9e7; color: #f06548; }

/* ---- Follow-up Reminder Cards ---- */
.followup-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.followup-item:last-child {
    border-bottom: none;
}

.followup-item.overdue {
    background: #fff5f5;
    border-left: 3px solid var(--danger);
}

.followup-item.today {
    background: #fffbeb;
    border-left: 3px solid var(--warning);
}

.followup-item.upcoming {
    background: #f0f9ff;
    border-left: 3px solid var(--info);
}

/* ---- Detail Info Grid ---- */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.detail-item {
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
}

.detail-item .detail-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 4px;
}

.detail-item .detail-value {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* ---- Commission Module ---- */
.commission-result {
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
    border: 2px solid var(--success);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    margin: 20px 0;
}

.commission-result .commission-total {
    font-size: 2rem;
    font-weight: 700;
    color: var(--success);
}

.commission-result .commission-formula {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.step-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.step-indicator .step-number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    flex-shrink: 0;
}

.step-indicator .step-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.commission-detail-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.commission-detail-card .detail-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border-color);
}

.commission-detail-card .detail-row:last-child {
    border-bottom: none;
}

.commission-detail-card .detail-row .label {
    color: var(--text-muted);
    font-weight: 500;
}

.commission-detail-card .detail-row .value {
    font-weight: 600;
    color: var(--text-primary);
}

.badge-pending { background: #fff3e0; color: #f7b84b; }
.badge-paid { background: #e8f5e9; color: #0ab39c; }

.commission-stat {
    text-align: center;
    padding: 16px;
}

.commission-stat .stat-amount {
    font-size: 1.3rem;
    font-weight: 700;
}

.commission-stat .stat-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ---- Print Styles ---- */
@media print {
    .sidebar,
    .top-header,
    .main-footer,
    .sidebar-overlay,
    .no-print {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        margin-top: 0 !important;
        padding: 0 !important;
    }

    body {
        background: #fff !important;
    }

    .card {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
}
