:root {
    --color-primary: #169ae5;
    --color-primary-dark: #0f7bc2;
    --color-primary-light: #3db1f5;
    --color-secondary: #6c757d;
    --color-success: #28a745;
    --color-danger: #dc3545;
    --color-warning: #ffc107;
    --color-info: #17a2b8;

    --sidebar-width: 260px;
    --topnav-height: 60px;

    --bg-primary: #f5f6f8;
    --bg-secondary: #ffffff;
    --bg-sidebar: #1f2733;
    --bg-card: #ffffff;

    --text-primary: #2d3748;
    --text-secondary: #718096;
    --text-light: #a0aec0;

    --border-color: #e2e8f0;
}

/* General Body */
body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
}

/* Layout Structure */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    color: white;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    overflow-y: auto;
    border-right: 1px solid #171d26;
    z-index: 1000;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.3);
    border-radius: 3px;
}

.sidebar-logo {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    background: rgba(0,0,0,0.15);
}

.logo-text {
    font-size: 22px;
    font-weight: 700;
    color: white;
    margin: 0;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.logo-icon {
    width: 34px;
    height: 34px;
    background: var(--color-primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 19px;
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    padding: 0 20px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255,255,255,0.45);
    margin-bottom: 8px;
    font-weight: 600;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 11px 20px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 14px;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: rgba(255,255,255,0.05);
    color: white;
    border-left-color: var(--color-primary);
}

.nav-link.active {
    background: rgba(22, 154, 229, 0.15);
    color: white;
    border-left-color: var(--color-primary);
    font-weight: 600;
}

.nav-link i {
    margin-right: 12px;
    font-size: 15px;
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Top Navigation */
.topnav {
    height: var(--topnav-height);
    background: white;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topnav-left h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
}

.topnav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
}

.user-menu:hover {
    background: var(--bg-primary);
}

.user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.user-role {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0;
}

/* Content Area */
.content-wrapper {
    flex: 1;
    padding: 28px 30px;
}

.page-header {
    margin-bottom: 28px;
}

.page-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 5px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    margin-bottom: 20px;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 16px 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    padding: 20px;
}

/* Metric Cards */
.metric-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 22px;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--color-primary);
}

.metric-card.primary::before { background: var(--color-primary); }
.metric-card.success::before { background: var(--color-success); }
.metric-card.warning::before { background: var(--color-warning); }
.metric-card.danger::before { background: var(--color-danger); }
.metric-card.info::before { background: var(--color-info); }

.metric-icon {
    width: 46px;
    height: 46px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
    margin-bottom: 14px;
}

.metric-icon.primary { background: #e8f4fd; color: var(--color-primary); }
.metric-icon.success { background: #eaf6ed; color: var(--color-success); }
.metric-icon.warning { background: #fdf6e3; color: #b38600; }
.metric-icon.danger { background: #fbebec; color: var(--color-danger); }
.metric-icon.info { background: #e8f5f8; color: var(--color-info); }

.metric-value {
    font-size: 30px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.metric-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: 500;
}

.metric-trend {
    font-size: 12px;
    margin-top: 10px;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-block;
}

.metric-trend.up {
    background: #eaf6ed;
    color: var(--color-success);
}

.metric-trend.down {
    background: #fbebec;
    color: var(--color-danger);
}

/* Forms */
.form-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
    margin-bottom: 6px;
}

.form-control, .form-select {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 9px 14px;
    font-size: 14px;
    background: #ffffff;
}

.form-control:focus, .form-select:focus {
    border-color: var(--color-primary);
    box-shadow: none;
    outline: 2px solid #cde9fb;
    outline-offset: 0;
    background: white;
}

/* Buttons */
.btn {
    border-radius: 8px;
    padding: 9px 18px;
    font-weight: 600;
    font-size: 14px;
    border: none;
}

.btn:focus {
    box-shadow: none;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--color-primary-dark);
}

.btn-success {
    background: var(--color-success);
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-danger {
    background: var(--color-danger);
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-warning {
    background: var(--color-warning);
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
    color: #212529;
}

.btn-secondary {
    background: var(--color-secondary);
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-info {
    background: var(--color-info);
    color: white;
}

.btn-info:hover {
    background: #138496;
}

/* Tables */
.table {
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 0;
}

.table thead th {
    background: #f8f9fb;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
    white-space: nowrap;
    vertical-align: middle;
}

.table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid #edf1f5;
    color: var(--text-primary);
    font-size: 14px;
    vertical-align: middle;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

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

/* DataTables custom */
.dataTables_wrapper {
    padding: 8px 20px 16px;
}

.dataTables_wrapper .row:first-child {
    padding: 10px 0;
}

.dataTables_length select,
.dataTables_filter input {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 12px;
    margin: 0 5px;
    background: white;
}

.dataTables_info {
    color: var(--text-secondary);
    font-size: 13px;
    padding-top: 12px;
}

.dataTables_paginate {
    padding-top: 8px;
}

.paginate_button {
    border-radius: 6px !important;
    margin: 0 2px;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
    background: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
    color: white !important;
}

/* Badges */
.badge {
    padding: 6px 10px;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: 0.3px;
    border-radius: 6px;
    text-transform: uppercase;
}

.badge.bg-danger { background: #dc3545 !important; }
.badge.bg-warning { background: #f0ad00 !important; color: #212529; }
.badge.bg-info { background: #17a2b8 !important; }
.badge.bg-primary { background: #169ae5 !important; }
.badge.bg-success { background: #28a745 !important; }
.badge.bg-secondary { background: #6c757d !important; }

/* Alerts */
.alert {
    border-radius: 8px;
    border: none;
    padding: 14px 18px;
}

.alert-success {
    background: #eaf6ed;
    color: #1e7e34;
    border-left: 4px solid var(--color-success);
}

.alert-danger {
    background: #fbebec;
    color: #b02a37;
    border-left: 4px solid var(--color-danger);
}

.alert-warning {
    background: #fdf6e3;
    color: #856404;
    border-left: 4px solid var(--color-warning);
}

.alert-info {
    background: #e8f5f8;
    color: #117a8b;
    border-left: 4px solid var(--color-info);
}

/* Select2 Custom */
.select2-container--default .select2-selection--single,
.select2-container--bootstrap-5 .select2-selection {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    min-height: 40px;
    background: #ffffff;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 38px;
    color: var(--text-primary);
    padding-left: 14px;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 38px;
}

.select2-dropdown {
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

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

    .sidebar.mobile-open {
        transform: translateX(0);
    }

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

    .content-wrapper {
        padding: 20px 15px;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-secondary);
}

/* ========================================
   RENEWAL MANAGEMENT SPECIFIC STYLES
   ======================================== */

/* Tabs Navigation */
.renewal-tabs {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 6px;
    margin-bottom: 24px;
    display: inline-flex;
    gap: 6px;
}

.renewal-tabs .nav-link {
    padding: 10px 20px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 14px;
    border: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.renewal-tabs .nav-link:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.renewal-tabs .nav-link.active {
    background: var(--color-primary);
    color: white;
}

.renewal-tabs .nav-link i {
    font-size: 15px;
}

/* Filter Card */
.filter-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 24px;
}

.filter-card .form-label {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
}

.filter-card .form-label i {
    color: var(--color-primary);
}

.filter-card small {
    color: var(--text-secondary);
}

/* Action Card */
.action-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid var(--border-color);
}

.action-card .card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.action-card .card-title i {
    color: var(--color-primary);
    font-size: 18px;
}

.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.action-buttons .btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    font-weight: 600;
}

.action-buttons .btn i {
    font-size: 15px;
}

.action-buttons .btn-success {
    background: #25D366;
}

.action-buttons .btn-success:hover {
    background: #1da851;
}

/* Selection Controls */
.selection-controls {
    display: flex;
    gap: 10px;
}

.selection-controls .btn {
    font-size: 13px;
    padding: 7px 14px;
}

/* Data Table Container */
.data-table-container {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.data-table-container .card-header {
    background: #ffffff;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.data-table-container .card-header h5 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.data-table-container .card-header h5 i {
    color: var(--color-primary);
}

/* Checkbox Styling */
.hosting-checkbox,
.client-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--color-primary);
}

/* Stats Counter */
.stats-counter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    background: var(--color-primary);
    color: white;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
}

/* Enhanced Select All */
.select-all-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--bg-primary);
    border-radius: 8px;
}

.select-all-container input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--color-primary);
}

.select-all-container label {
    margin: 0;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 14px;
}

/* WhatsApp Link Styling */
.whatsapp-link {
    color: #25D366 !important;
    font-weight: 600;
    text-decoration: none;
}

.whatsapp-link:hover {
    color: #1da851 !important;
    text-decoration: underline;
}

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

.empty-state i {
    font-size: 56px;
    color: var(--text-light);
    margin-bottom: 20px;
}

.empty-state h4 {
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-light);
    font-size: 14px;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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