/* ===== Reset & Base ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0a0a1a;
    color: #fff;
    min-height: 100vh;
}

/* ===== Sidebar ===== */
.sidebar {
    position: fixed; left: 0; top: 0; width: 240px; height: 100vh;
    background: rgba(255,255,255,0.03);
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(255,255,255,0.05);
    padding: 20px;
}
.sidebar h2 {
    font-size: 20px; margin-bottom: 4px;
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.sidebar .user-info { font-size: 12px; color: rgba(255,255,255,0.4); margin-bottom: 24px; margin-top: 10px; }
.sidebar .user-info .role {
    display: inline-block; border-radius: 6px; font-size: 14px;
}

/* ===== Navigation ===== */
.nav-menu { list-style: none; margin-top: 20px; }
.nav-menu li { margin-bottom: 4px; }
.nav-menu a {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px;
    color: rgba(255,255,255,0.6); text-decoration: none; border-radius: 10px;
    transition: all 0.2s; font-size: 14px;
}
.nav-menu a:hover, .nav-menu a.active { background: rgba(255,255,255,0.08); color: #fff; }
.nav-menu a.active { background: rgba(79,172,254,0.15); color: #4facfe; }
.nav-divider { height: 1px; background: rgba(255,255,255,0.05); margin: 12px 0; }
.nav-logout { margin-top: 24px; }
.nav-logout a { color: rgba(255,71,87,0.6); }
.nav-logout a:hover { color: #ff4757; }
.nav-icon { width: 20px; height: 20px; flex-shrink: 0; }
.nav-icon svg { width: 100%; height: 100%; fill: currentColor; }

/* ===== Main Content ===== */
.main-content { margin-left: 240px; padding: 30px 40px; }
.page-header {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
    flex-direction: column;
    align-content: flex-start;
    align-items: flex-start;
    justify-content: center;
}
.page-header h1 { font-size: 24px; }
.page-header .back-link { color: rgba(255,255,255,0.4); text-decoration: none; font-size: 14px; }
.page-header .back-link:hover { color: #4facfe; }

/* ===== Cards ===== */
.stat-card, .action-card, .info-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    padding: 20px;
}
.stat-card { text-align: center; }
.stat-card .stat-icon { font-size: 32px; margin-bottom: 8px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; }
.stat-card .stat-label { font-size: 13px; color: rgba(255,255,255,0.4); margin-top: 4px; }

.action-card {
    text-align: center; cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    text-decoration: none; color: inherit; display: block;
}
.action-card:hover { transform: translateY(-2px); border-color: rgba(79,172,254,0.3); }
.action-card .action-icon { font-size: 40px; margin-bottom: 10px; }
.action-card .action-title { font-size: 16px; font-weight: 600; }
.action-card .action-desc { font-size: 13px; color: rgba(255,255,255,0.4); margin-top: 4px; }

.detail-card { max-width: 500px;
            background: rgba(255,255,255,0.03);
            border: 1px solid rgba(255,255,255,0.08);
            border-radius: 16px;
            padding: 24px; }
.detail-card .info-row { display: flex; justify-content: space-between;
            padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.04);
            font-size: 14px; }
.detail-card .info-row:last-child { border-bottom: none; }
.detail-card .info-label { color: rgba(255,255,255,0.5); }
.detail-card .info-value { color: #fff; font-weight: 500; }


/* ===== Grids ===== */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px; }
.actions-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ===== Buttons ===== */
.btn {
    display: inline-block; padding: 10px 20px; border-radius: 10px;
    text-decoration: none; font-size: 14px; font-weight: 500;
    cursor: pointer; border: none; transition: all 0.2s;
}

.btn:hover {
    transform: translateY(-1px);
}
.btn:active {
    transform: translateY(0);
}

.btn-primary { background: #4facfe; color: #fff; }
.btn-primary:hover { background: #3d9be8; }
.btn-success { background: rgba(46,213,115,0.2); color: #2ed573; }
.btn-success:hover { background: rgba(46,213,115,0.3); }
.btn-danger { background: rgba(255,71,87,0.2); color: #ff4757; }
.btn-danger:hover { background: rgba(255,71,87,0.3); }
.btn-warning { background: rgba(255,165,2,0.2); color: #ffa502; }
.btn-warning:hover { background: rgba(255,165,2,0.3); }
.btn-close { background: rgba(255,71,87,0.2); color: #ff4757; }
.btn-close:hover { background: rgba(255,71,87,0.3); }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; color: rgba(255,255,255,0.5); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 10px 14px; background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1); border-radius: 10px;
    color: #fff; font-size: 14px; outline: none;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: #4facfe;
}

/* ===== Modal ===== */
.modal-overlay {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.7); z-index: 1000;
    justify-content: center; align-items: center;
}
.modal-overlay.active { display: flex; }
.modal {
    background: #1a1a2e; border-radius: 16px; padding: 24px;
    width: 90%; max-width: 500px; max-height: 80vh; overflow-y: auto;
}
.modal h2 { font-size: 18px; margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.modal-box {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}
.modal-box h3 {
    margin: 0 0 12px;
}
.modal-box p {
    margin: 0 0 20px;
    color: var(--text-secondary);
}

/* ===== Tables ===== */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left; padding: 12px 16px; font-size: 13px;
    color: rgba(255,255,255,0.4); border-bottom: 1px solid rgba(255,255,255,0.08);
}
.data-table td {
    padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,0.05);
}
.data-table tr:hover { background: rgba(255,255,255,0.02); }

/* ===== Status Badges ===== */
.status-badge {
    display: inline-block; padding: 4px 12px; border-radius: 20px;
    font-size: 12px; font-weight: 500;
}
.status-active { background: rgba(46,213,115,0.2); color: #2ed573; }
.status-inactive { background: rgba(255,71,87,0.2); color: #ff4757; }
.status-pending { background: rgba(255,165,2,0.2); color: #ffa502; }

/* ===== Login Page ===== */
.login-container {
    display: flex; justify-content: center; align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}
.login-box {
    background: rgba(255,255,255,0.05); backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.1); border-radius: 20px;
    padding: 40px; width: 100%; max-width: 400px;
}
.login-box h1 {
    text-align: center; margin-bottom: 30px;
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.login-box .error-msg {
    background: rgba(255,71,87,0.1); border: 1px solid rgba(255,71,87,0.3);
    color: #ff4757; padding: 10px; border-radius: 10px; margin-bottom: 16px;
    font-size: 14px; text-align: center;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar { display: none; }
    .main-content { margin-left: 0; padding: 20px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .actions-grid { grid-template-columns: 1fr; }
    .info-grid { grid-template-columns: 1fr; }
}
/* ===== Visible password ===== */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    flex: 1;
    padding-right: 40px;
}

.toggle-password {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 12px;
    padding: 4px;
    opacity: 0.6;
    transition: opacity 0.2s;
    color: white;
}

.toggle-password:hover {
    opacity: 1;
}

/* ==== CRM Page ==== */

.crm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}
.crm-header h1 { font-size: 24px; font-weight: 600; color: #fff; margin: 0; }

.crm-search {
    flex: 1;
    max-width: 400px;
    min-width: 200px;
}
.crm-search input {
    width: 100%;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: #fff;
    padding: 10px 14px 10px 38px;
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='rgba(255,255,255,0.4)'%3E%3Cpath d='M15.5 14h-.79l-.28-.27A6.47 6.47 0 0016 9.5 6.5 6.5 0 109.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
    background-size: 18px;
}
.crm-search input:focus { border-color: rgba(99,102,241,0.5); }
.crm-search input::placeholder { color: rgba(255,255,255,0.35); }

.crm-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.crm-stat-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 10px;
    padding: 14px 18px;
    flex: 1;
    min-width: 90px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.crm-stat-card:hover { background: rgba(255,255,255,0.07); }
.crm-stat-card .stat-number { font-size: 24px; font-weight: 700; color: #fff; }
.crm-stat-card .stat-label { font-size: 12px; color: rgba(255,255,255,0.5); margin-top: 2px; }

.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.filter-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.6);
    padding: 7px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}
.filter-btn:hover { background: rgba(255,255,255,0.1); color: #fff; }
.filter-btn.active {
    background: rgba(99,102,241,0.2);
    border-color: rgba(99,102,241,0.5);
    color: #a5b4fc;
}

.lead-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
}
.lead-card:hover {
    border-color: rgba(99,102,241,0.4);
    background: rgba(255,255,255,0.06);
}
.lead-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}
.lead-name { font-size: 15px; font-weight: 600; color: #fff; }
.lead-meta { font-size: 12px; color: rgba(255,255,255,0.4); }
.lead-contact {
    display: flex;
    gap: 14px;
    font-size: 13px;
    color: rgba(255,255,255,0.55);
    flex-wrap: wrap;
}
.lead-contact a { color: #818cf8; text-decoration: none; }
.lead-contact a:hover { text-decoration: underline; }

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
    vertical-align: middle;
}
.status-new { background: rgba(59,130,246,0.15); color: #60a5fa; }
.status-contacted { background: rgba(234,179,8,0.15); color: #facc15; }
.status-qualified { background: rgba(168,85,247,0.15); color: #c084fc; }
.status-converted { background: rgba(34,197,94,0.15); color: #4ade80; }
.status-lost { background: rgba(239,68,68,0.15); color: #f87171; }

/* ===== Slide Panel ===== */
.panel-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 998;
    opacity: 0; visibility: hidden;
    transition: all 0.3s;
}
.panel-overlay.open { opacity: 1; visibility: visible; }    

.slide-panel {
    position: fixed; top: 0; right: -500px;
    width: 460px; height: 100vh;
    background: #16162a;
    border-left: 1px solid rgba(255,255,255,0.1);
    z-index: 999;
    transition: right 0.3s ease;
    overflow-y: auto;
    box-shadow: -4px 0 30px rgba(0,0,0,0.4);
}
.slide-panel.open { right: 0; }

.slide-panel-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    position: sticky; top: 0;
    background: #16162a;
    z-index: 10;
}
.slide-panel-header h2 { font-size: 18px; color: #fff; margin: 0; }
.slide-panel-close {
    background: none; border: none; color: rgba(255,255,255,0.5);
    font-size: 22px; cursor: pointer; padding: 4px 8px; border-radius: 6px;
    transition: all 0.2s;
}
.slide-panel-close:hover { color: #fff; background: rgba(255,255,255,0.1); }

.slide-panel-body { padding: 20px 24px; }

.panel-status { margin-bottom: 20px; }
.panel-status label { font-size: 12px; color: rgba(255,255,255,0.5); display: block; margin-bottom: 6px; }
.panel-status select {
    width: 100%;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: #fff;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
}
.panel-status select option { background: #1e1e2e; color: #fff; }

.panel-field { margin-bottom: 16px; }
.panel-field label {
    font-size: 11px; color: rgba(255,255,255,0.4);
    text-transform: uppercase; letter-spacing: 0.5px;
    display: block; margin-bottom: 4px;
}
.panel-field .field-value {
    font-size: 15px; color: #fff;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}
.panel-field .field-value.empty { color: rgba(255,255,255,0.25); font-style: italic; }
.panel-field input, .panel-field textarea {
    width: 100%;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: #fff;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    font-family: inherit;
}
.panel-field input:focus, .panel-field textarea:focus { border-color: rgba(99,102,241,0.5); }
.panel-field textarea { resize: vertical; min-height: 80px; }

.panel-notes { margin-top: 20px; padding-top: 16px; border-top: 1px solid rgba(255,255,255,0.08); }
.panel-notes h3 { font-size: 14px; color: rgba(255,255,255,0.7); margin: 0 0 12px; }

.note-item {
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
}
.note-date { font-size: 11px; color: rgba(255,255,255,0.35); }
.note-text { font-size: 14px; color: rgba(255,255,255,0.8); margin-top: 4px; }

.note-input-row {
    display: flex; gap: 8px; margin-top: 12px;
}
.note-input-row input {
    flex: 1;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
}
.note-input-row input:focus { border-color: rgba(99,102,241,0.5); }
.note-input-row button {
    background: rgba(99,102,241,0.2);
    border: 1px solid rgba(99,102,241,0.4);
    color: #a5b4fc;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
}
.note-input-row button:hover { background: rgba(99,102,241,0.3); }

.panel-actions {
    display: flex; gap: 10px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.btn-edit {
    background: rgba(99,102,241,0.15);
    border: 1px solid rgba(99,102,241,0.3);
    color: #a5b4fc;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}
.btn-edit:hover { background: rgba(99,102,241,0.25); }
.btn-delete-panel {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    color: #f87171;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.btn-delete-panel:hover { background: rgba(239,68,68,0.2); }
.btn-save {
    background: rgba(34,197,94,0.15);
    border: 1px solid rgba(34,197,94,0.3);
    color: #4ade80;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}
.btn-save:hover { background: rgba(34,197,94,0.25); }
.btn-cancel {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.6);
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
}
.btn-cancel:hover { background: rgba(255,255,255,0.1); }

.empty-state {
    text-align: center; padding: 60px 20px;
    color: rgba(255,255,255,0.25); font-size: 16px;
}

@media (max-width: 768px) {
    .slide-panel { width: 100%; }
    .crm-header { flex-direction: column; align-items: stretch; }
    .crm-search { max-width: 100%; }
}
