/* =====================================
   WEBNEST ANALYTICS DASHBOARD
===================================== */

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

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f5f7;
    color: #222;
    min-height: 100vh;
}

/* =====================================
   DASHBOARD LAYOUT
===================================== */

.dashboard-layout,
.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* =====================================
   SIDEBAR
===================================== */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100vh;
    background: #222222;
    color: white;
    padding: 28px 20px;
    z-index: 1000;
}

.sidebar h1,
.sidebar-logo,
.brand {
    color: #ffd700;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 42px;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
}

.sidebar a,
.sidebar nav a {
    display: block;
    color: white;
    text-decoration: none;
    font-size: 16px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
    transition: color 0.2s ease;
}

.sidebar a:hover,
.sidebar a.active,
.sidebar nav a.active {
    color: #ffd700;
}

/* =====================================
   MAIN CONTENT
===================================== */

.main-content,
.dashboard-main {
    width: calc(100% - 240px);
    min-height: 100vh;
    margin-left: 240px;
    padding: 30px 34px 60px;
}

/* =====================================
   DASHBOARD HEADER
===================================== */

.dashboard-header,
.top-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 32px;
}

.dashboard-header h1,
.top-header h1,
.main-content > h1 {
    font-size: 37px;
    line-height: 1.1;
    margin-bottom: 6px;
    color: #222;
}

.dashboard-header p,
.top-header p,
.welcome-message {
    color: #666;
    font-size: 16px;
}

.role-badge,
.admin-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffd700;
    color: #111;
    font-size: 16px;
    font-weight: 700;
    padding: 10px 19px;
    border-radius: 30px;
}

/* =====================================
   STAT CARDS
===================================== */

.stats-grid,
.dashboard-stats,
.cards {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card,
.card,
.analytics-card {
    background: white;
    min-height: 120px;
    padding: 26px 25px;
    border-radius: 17px;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.06);
}

.stat-card p,
.stat-card span,
.card p,
.analytics-card p {
    color: #666;
    font-size: 16px;
    margin-bottom: 9px;
}

.stat-card h2,
.stat-card h3,
.card h2,
.card h3,
.analytics-card h2 {
    color: #222;
    font-size: 38px;
    line-height: 1;
    font-weight: 700;
}

/*
Keeps a fourth card on the next line,
matching the dashboard screenshot.
*/
.stats-grid > :nth-child(4),
.dashboard-stats > :nth-child(4),
.cards > :nth-child(4) {
    grid-column: 1;
}

/* =====================================
   TOP PAGES SECTION
===================================== */

.top-pages,
.table-card,
.analytics-table {
    background: white;
    width: 100%;
    padding: 25px;
    border-radius: 17px;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.06);
}

.top-pages h2,
.table-card h2,
.analytics-table h2 {
    font-size: 25px;
    margin-bottom: 20px;
    color: #222;
}

/* =====================================
   TABLE
===================================== */

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #f7f7f7;
}

th,
td {
    padding: 15px 14px;
    text-align: left;
    border-bottom: 1px solid #e8e8e8;
    font-size: 16px;
}

th {
    color: #222;
    font-weight: 700;
}

td {
    color: #222;
}

th:last-child,
td:last-child {
    text-align: left;
    width: 22%;
}

/* =====================================
   SITES PAGE
===================================== */

.page-card,
.sites-card {
    background: white;
    border-radius: 17px;
    padding: 25px;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.06);
}

.page-card h2,
.sites-card h2 {
    margin-bottom: 20px;
}

/* =====================================
   BUTTONS
===================================== */

.button,
.btn,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #ffd700;
    color: #111;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.button:hover,
.btn:hover,
button:hover {
    background: #e9c500;
}

/* =====================================
   RESPONSIVE
===================================== */

@media (max-width: 1000px) {

    .stats-grid,
    .dashboard-stats,
    .cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stats-grid > :nth-child(4),
    .dashboard-stats > :nth-child(4),
    .cards > :nth-child(4) {
        grid-column: auto;
    }
}

@media (max-width: 768px) {

    .dashboard-layout,
    .dashboard-container {
        display: block;
    }

    .sidebar {
        position: relative;
        width: 100%;
        height: auto;
        padding: 20px;
    }

    .sidebar h1,
    .sidebar-logo,
    .brand {
        margin-bottom: 20px;
    }

    .sidebar nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px 20px;
    }

    .sidebar a,
    .sidebar nav a {
        border-bottom: none;
        padding: 7px 0;
    }

    .main-content,
    .dashboard-main {
        width: 100%;
        margin-left: 0;
        padding: 25px 18px 50px;
    }

    .dashboard-header,
    .top-header {
        gap: 20px;
    }

    .dashboard-header h1,
    .top-header h1,
    .main-content > h1 {
        font-size: 30px;
    }

    .stats-grid,
    .dashboard-stats,
    .cards {
        grid-template-columns: 1fr;
    }

    .stats-grid > :nth-child(4),
    .dashboard-stats > :nth-child(4),
    .cards > :nth-child(4) {
        grid-column: auto;
    }

    .top-pages,
    .table-card,
    .analytics-table {
        overflow-x: auto;
    }

    table {
        min-width: 600px;
    }
}