/* RyvixHost Design System — Modern & Clean Edition */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    height: 100%;
}

body {
    font-family: 'Plus Jakarta Sans', 'Inter', system-ui, -apple-system, sans-serif;
    background-color: #f0f2f5;
    color: #13111a;
    margin: 0;
    padding: 0;
    min-height: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ========================================================
   SIDEBAR
   ======================================================== */
.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    width: 15.5rem;
    background-color: #0e0c14;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255,255,255,0.06);
    overflow-y: auto;
    /* Subtle grain texture via SVG */
    background-image:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.03'/%3E%3C/svg%3E"),
        linear-gradient(180deg, #0e0c14 0%, #100e18 100%);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    height: 4rem;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.sidebar-logo a {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-logo-mark {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, #e11d48, #be123c);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(225,29,72,0.4);
    flex-shrink: 0;
}

.sidebar-logo-text {
    font-size: 1.05rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.02em;
}

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

.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-section-title {
    font-size: 0.65rem;
    font-weight: 600;
    color: rgba(255,255,255,0.28);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    padding: 0 0.875rem;
    margin-bottom: 0.625rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.875rem;
    border-radius: 0.625rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255,255,255,0.42);
    text-decoration: none;
    transition: all 200ms ease;
    margin-bottom: 0.2rem;
    position: relative;
}

.sidebar-link:hover {
    background-color: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.85);
}

.sidebar-link.active {
    background-color: rgba(225,29,72,0.12);
    color: #ffffff;
    font-weight: 600;
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: #e11d48;
    border-radius: 0 3px 3px 0;
    box-shadow: 0 0 8px rgba(225,29,72,0.6);
}

.sidebar-link i {
    width: 1.125rem;
    text-align: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.sidebar-link.active i {
    color: #f43f5e;
}

.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,0.06);
    padding: 1rem 0.875rem;
    flex-shrink: 0;
}

/* ========================================================
   TOPBAR & LAYOUT
   ======================================================== */
.topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: 15.5rem;
    height: 4rem;
    background-color: rgba(240, 242, 245, 0.9);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0,0,0,0.07);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 40;
}

.main-content {
    margin-left: 15.5rem;
    padding-top: 4rem;
    min-height: 100vh;
    background-color: #f0f2f5;
    display: flex;
    flex-direction: column;
}

.page-content {
    padding: 2rem;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
    flex: 1 0 auto;
}

/* ========================================================
   PAGE HEADERS
   ======================================================== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: #13111a;
    letter-spacing: -0.035em;
    margin: 0;
    line-height: 1.1;
}

.page-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.3rem;
    margin-bottom: 0;
    font-weight: 400;
}

/* ========================================================
   METRIC CARDS & GRIDS
   ======================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.metric-card {
    background-color: #ffffff;
    border-radius: 1rem;
    border: 1px solid rgba(0,0,0,0.07);
    padding: 1.375rem 1.5rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.02);
    transition: transform 220ms cubic-bezier(0.34,1.56,0.64,1), box-shadow 220ms ease;
    position: relative;
    overflow: hidden;
}

.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

/* Accent strip at top of metric card */
.metric-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(0,0,0,0.06), transparent);
}

.metric-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #8b92a5;
    letter-spacing: 0.01em;
    margin: 0 0 0.625rem 0;
    text-transform: none;
}

.metric-value {
    font-size: 2rem;
    font-weight: 700;
    color: #13111a;
    margin: 0;
    line-height: 1;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
}

/* ========================================================
   CARDS
   ======================================================== */
.card {
    background-color: #ffffff;
    border-radius: 1rem;
    border: 1px solid rgba(0,0,0,0.07);
    padding: 1.5rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 16px rgba(0,0,0,0.02);
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid #f3f4f6;
    padding-bottom: 0.875rem;
}

.card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #13111a;
    margin: 0;
    letter-spacing: -0.01em;
}

/* ========================================================
   BUTTONS
   ======================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: 0.625rem;
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 180ms ease;
    border: 1px solid transparent;
    line-height: 1.25;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, #e11d48, #be123c);
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(225,29,72,0.28), inset 0 1px 0 rgba(255,255,255,0.1);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #be123c, #9f1239);
    box-shadow: 0 6px 16px rgba(225,29,72,0.35);
}

.btn-secondary {
    background-color: #ffffff;
    color: #374151 !important;
    border-color: rgba(0,0,0,0.12);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.btn-secondary:hover {
    background-color: #f9fafb;
    border-color: rgba(0,0,0,0.18);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    border-radius: 0.5rem;
}

/* ========================================================
   BADGES
   ======================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.625rem;
    border-radius: 5px;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.01em;
}

.badge-active, .badge-paid {
    background-color: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.badge-pending {
    background-color: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.badge-suspended, .badge-overdue, .badge-failed {
    background-color: #fff1f2;
    color: #be123c;
    border: 1px solid #fecdd3;
}

.badge-open {
    background-color: #fffbeb;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* ========================================================
   TABLES
   ======================================================== */
.table-wrapper {
    background-color: #ffffff;
    border-radius: 1rem;
    border: 1px solid rgba(0,0,0,0.07);
    overflow-x: auto;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.table {
    width: 100%;
    font-size: 0.875rem;
    border-collapse: collapse;
    text-align: left;
}

.table th {
    padding: 0.875rem 1.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    color: #8b92a5;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    background-color: #fafafa;
    border-bottom: 1px solid #f0f0f0;
}

.table td {
    padding: 1rem 1.25rem;
    color: #374151;
    border-bottom: 1px solid #f7f7f8;
    vertical-align: middle;
}

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

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

/* ========================================================
   EMPTY STATE
   ======================================================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
}

.empty-state-icon-wrapper {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 1rem;
    background-color: #f3f4f6;
    color: #9ca3af;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.375rem;
    margin-bottom: 1rem;
}

.empty-state-title {
    font-size: 1rem;
    font-weight: 600;
    color: #13111a;
    margin: 0 0 0.35rem 0;
    letter-spacing: -0.01em;
}

.empty-state-text {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0 0 1.25rem 0;
    max-width: 28rem;
    line-height: 1.6;
    text-wrap: balance;
}

/* ========================================================
   DROPDOWN
   ======================================================== */
.dropdown { position: relative; }

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    width: 13rem;
    background-color: #ffffff;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 0.875rem;
    box-shadow: 0 16px 40px -8px rgba(0,0,0,0.14), 0 4px 12px -4px rgba(0,0,0,0.06);
    padding: 0.375rem;
    z-index: 100;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    color: #374151;
    text-decoration: none;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: background-color 0.15s ease;
}

.dropdown-item:hover {
    background-color: #f5f5f7;
}

.dropdown-item.text-red-600 { color: #e11d48; }
.dropdown-item.text-red-600:hover { background-color: #fff1f2; }

/* ========================================================
   SCROLLBAR
   ======================================================== */
.scrollbar-thin::-webkit-scrollbar {
    width: 3px;
}
.scrollbar-thin::-webkit-scrollbar-thumb {
    background-color: rgba(255,255,255,0.1);
    border-radius: 4px;
}

/* ========================================================
   ALERT / FLASH MESSAGES
   ======================================================== */
.alert {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid transparent;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
}

.alert-success { background-color: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.alert-error { background-color: #fff1f2; color: #be123c; border-color: #fecdd3; }
.alert-warning { background-color: #fffbeb; color: #92400e; border-color: #fde68a; }
.alert-info { background-color: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }

/* ========================================================
   FORMS
   ======================================================== */
.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.375rem;
    letter-spacing: -0.005em;
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.6rem 0.875rem;
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 400;
    color: #13111a;
    background-color: #ffffff;
    border: 1px solid rgba(0,0,0,0.12);
    border-radius: 0.625rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    appearance: none;
    line-height: 1.5;
}

.form-control:focus {
    outline: none;
    border-color: #e11d48;
    box-shadow: 0 0 0 3px rgba(225,29,72,0.1);
}

.form-control::placeholder {
    color: #adb5bd;
}

/* ========================================================
   SECTION HEADER LINKS
   ======================================================== */
.section-link {
    font-size: 0.8125rem;
    color: #e11d48;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: gap 0.15s ease;
}

.section-link:hover {
    gap: 0.5rem;
}

/* ========================================================
   SERVICE ITEM ROW
   ======================================================== */
.service-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem;
    border-radius: 0.75rem;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 180ms ease;
    background-color: transparent;
}

.service-row:hover {
    background-color: #f8f8fa;
    border-color: rgba(0,0,0,0.06);
}

.service-icon {
    width: 2.25rem;
    height: 2.25rem;
    background-color: #f3f4f6;
    border-radius: 0.625rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #6b7280;
    font-size: 0.875rem;
}

/* ========================================================
   FLOATING CHAT BUTTON
   ======================================================== */
.chat-floating-btn {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #e11d48, #be123c);
    color: #ffffff;
    font-family: 'Plus Jakarta Sans', 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.7rem 1.25rem;
    border-radius: 9999px;
    box-shadow: 0 8px 24px rgba(225,29,72,0.35);
    border: none;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34,1.56,0.64,1);
}

.chat-floating-btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 12px 32px rgba(225,29,72,0.45);
}

/* ========================================================
   RESPONSIVE
   ======================================================== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 220ms ease;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .topbar {
        left: 0;
    }
    .main-content {
        margin-left: 0;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-layout {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 640px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .page-content {
        padding: 1.25rem;
    }
}
