/* =============================================
   HOREBOT CRM — Custom Styles
   ============================================= */

:root {
    --sidebar-width: 250px;
    --sidebar-collapsed: 0px;
    --primary-color: #1a2b4a;
    --primary-light: #2c4270;
    --primary-dark: #0f1b33;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-light: #f1f5f9;
    --text-muted: #64748b;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background-color: var(--bg-light);
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: #fff;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar.collapsed {
    transform: translateX(calc(-1 * var(--sidebar-width)));
}

.sidebar-brand {
    padding: 1.25rem 1.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand i {
    font-size: 1.5rem;
    color: var(--accent-color);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    color: #fff;
    background-color: rgba(255,255,255,0.08);
}

.sidebar-link.active {
    color: #fff;
    background-color: rgba(255,255,255,0.12);
    border-left-color: var(--accent-color);
}

.sidebar-link i {
    font-size: 1.15rem;
    width: 1.5rem;
    text-align: center;
}

.sidebar-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 0.5rem 1.5rem;
}

.sidebar-heading {
    padding: 0.75rem 1.5rem 0.25rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.4);
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.4);
    text-align: center;
}

/* ---- Main Content ---- */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

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

.top-navbar {
    background: #fff;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 500;
}

.sidebar-toggle {
    font-size: 1.5rem;
    color: var(--primary-color);
    padding: 0;
    border: none;
}

.navbar-breadcrumb {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.navbar-breadcrumb a {
    color: var(--accent-color);
    text-decoration: none;
}

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

.page-content {
    padding: 1.5rem;
}

/* ---- Cards ---- */
.stat-card {
    background: #fff;
    border-radius: 0.75rem;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.stat-card.clickable-card {
    cursor: pointer;
    text-decoration: none;
    display: block;
    color: inherit;
}

.stat-card.clickable-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    border-color: #cbd5e1;
}

.stat-card .stat-footer {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: color 0.2s ease;
    border-top: 1px dashed #f1f5f9;
    padding-top: 0.75rem;
    margin-top: 0.85rem;
}

.stat-card.clickable-card:hover .stat-footer {
    color: var(--primary-color);
}

.stat-card.clickable-card:hover .stat-footer .bi-arrow-right {
    transform: translateX(4px);
}

.stat-card .stat-footer .bi-arrow-right {
    transition: transform 0.2s ease;
}

.metric-pill {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
}

.metric-pill-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-right: 0.35rem;
}

.metric-pill-value {
    font-weight: 600;
    color: var(--primary-color);
}

.dashboard-chart-container {
    position: relative;
    height: 300px;
    max-height: 300px;
    width: 100%;
    overflow: hidden;
}

.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ---- Page Header ---- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

/* ---- Tables ---- */
.table-card {
    background: #fff;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    overflow: hidden;
}

.table-card .table {
    margin-bottom: 0;
}

.table-card .table th {
    background: #f8fafc;
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 2px solid #e2e8f0;
    padding: 0.75rem 1rem;
}

.table-sort-link {
    color: inherit;
    transition: color 0.15s ease-in-out;
}

.table-sort-link:hover {
    color: var(--primary-color) !important;
}

.table-sort-link i {
    font-size: 0.85rem;
}

.table-card .table td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
}

.table-card .table tbody tr:hover {
    background-color: #f8fafc;
}

/* ---- Badges ---- */
.badge-status {
    padding: 0.35em 0.75em;
    border-radius: 50rem;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-active { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #f1f5f9; color: #475569; }
.badge-expired { background: #fee2e2; color: #991b1b; }
.badge-terminated { background: #fef3c7; color: #92400e; }
.badge-paid { background: #d1fae5; color: #065f46; }
.badge-unpaid { background: #fee2e2; color: #991b1b; }
.badge-overdue { background: #991b1b; color: #fff; }
.badge-private { background: #ede9fe; color: #5b21b6; }
.badge-company { background: #dbeafe; color: #1e40af; }

/* ---- Forms ---- */
.form-card {
    background: #fff;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    padding: 1.5rem;
}

.form-card .form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #334155;
}

.form-section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent-color);
    margin-bottom: 1rem;
    margin-top: 1.5rem;
}

.form-section-title:first-of-type {
    margin-top: 0;
}

/* ---- Detail Page ---- */
.detail-card {
    background: #fff;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.detail-card h5 {
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--accent-color);
}

.detail-row {
    display: flex;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f5f9;
}

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

.detail-label {
    width: 180px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.detail-value {
    flex: 1;
    color: #1e293b;
}

/* ---- Search Bar ---- */
.search-bar {
    background: #fff;
    border-radius: 0.75rem;
    border: 1px solid #e2e8f0;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
}

/* ---- File Upload ---- */
.file-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    background: #f8fafc;
}

.file-list-item .file-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.file-list-item .file-icon {
    font-size: 1.5rem;
    color: var(--accent-color);
}

.file-list-item .file-name {
    font-weight: 600;
    color: #1e293b;
}

.file-list-item .file-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ---- Clickable Row ---- */
.clickable-row {
    cursor: pointer;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(calc(-1 * var(--sidebar-width)));
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .detail-row {
        flex-direction: column;
    }
    .detail-label {
        width: 100%;
        margin-bottom: 0.25rem;
    }
}
