/* didit SpeedDash — Branded Stylesheet */

:root {
    --primary: #E8173A;
    --primary-dark: #C41230;
    --secondary: #1A1A2E;
    --accent: #F5F5F5;
    --white: #FFFFFF;
    --gray-50: #FAFAFA;
    --gray-100: #F0F0F0;
    --gray-200: #E0E0E0;
    --gray-300: #CCCCCC;
    --gray-400: #999999;
    --gray-500: #666666;
    --gray-600: #444444;
    --gray-700: #333333;
    --gray-800: #222222;
    --green: #27AE60;
    --blue: #2980B9;
    --orange: #F39C12;
    --deep-orange: #E67E22;
    --red: #E8173A;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
    --radius: 8px;
    --radius-lg: 12px;
    --sidebar-width: 250px;
    --transition: 0.2s ease;
}

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

html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    background: var(--accent);
    color: var(--gray-700);
    line-height: 1.6;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--secondary);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-logo {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo a {
    color: var(--white);
    text-decoration: none;
    font-size: 1.2rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

.logo-didit {
    color: var(--primary);
    font-weight: 800;
    letter-spacing: -0.5px;
}

.logo-separator {
    color: rgba(255,255,255,0.3);
    font-weight: 300;
}

.logo-app {
    font-weight: 500;
    font-size: 1.05rem;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all var(--transition);
    border-left: 3px solid transparent;
}

.nav-item:hover {
    color: var(--white);
    background: rgba(255,255,255,0.06);
    text-decoration: none;
}

.nav-item.active {
    color: var(--white);
    background: rgba(232,23,58,0.15);
    border-left-color: var(--primary);
}

.nav-item svg {
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
}

.logout-link {
    font-size: 0.85rem;
}

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

/* Page Headers */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--secondary);
}

/* Breadcrumbs */
.breadcrumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--gray-400);
    margin-bottom: 8px;
}

.breadcrumbs a {
    color: var(--gray-500);
}

.breadcrumbs span {
    color: var(--gray-700);
    font-weight: 600;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 20px;
    transition: box-shadow var(--transition);
}

.card:hover {
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-header h2,
.card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--secondary);
}

/* Summary Bar */
.summary-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.summary-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.summary-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--white);
    flex-shrink: 0;
}

.summary-icon.blue { background: var(--blue); }
.summary-icon.green { background: var(--green); }
.summary-icon.red { background: var(--red); }
.summary-icon.orange { background: var(--orange); }

.summary-info .summary-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--secondary);
    line-height: 1.2;
}

.summary-info .summary-label {
    font-size: 0.8rem;
    color: var(--gray-400);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Site Grid */
.site-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}

.site-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    color: inherit;
    display: block;
    border: 2px solid transparent;
}

.site-card:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
    text-decoration: none;
    transform: translateY(-2px);
}

.site-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.site-card-name {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 4px;
}

.site-card-url {
    font-size: 0.8rem;
    color: var(--gray-400);
    word-break: break-all;
}

.site-card-stats {
    display: flex;
    gap: 20px;
    margin-top: 12px;
}

.site-card-stat {
    text-align: center;
}

.site-card-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--secondary);
}

.site-card-stat-label {
    font-size: 0.7rem;
    color: var(--gray-400);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.site-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--gray-100);
}

.site-card-time {
    font-size: 0.78rem;
    color: var(--gray-400);
}

/* Grade Badge */
.grade-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--white);
    flex-shrink: 0;
    letter-spacing: -0.5px;
}

.grade-badge-sm {
    width: 30px;
    height: 30px;
    font-size: 0.85rem;
    border-radius: 6px;
}

.grade-badge-lg {
    width: 64px;
    height: 64px;
    font-size: 1.8rem;
    border-radius: var(--radius-lg);
}

/* Trend Indicators */
.trend {
    font-weight: 700;
    font-size: 1.1rem;
}

.trend-up {
    color: var(--green);
}

.trend-down {
    color: var(--red);
}

.trend-same {
    color: var(--gray-300);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-superadmin { background: rgba(232,23,58,0.12); color: var(--red); }
.badge-admin { background: rgba(41,128,185,0.12); color: var(--blue); }
.badge-viewer { background: rgba(153,153,153,0.15); color: var(--gray-500); }
.badge-active { background: rgba(39,174,96,0.12); color: var(--green); }
.badge-inactive { background: rgba(153,153,153,0.15); color: var(--gray-400); }
.badge-success { background: rgba(39,174,96,0.12); color: var(--green); }
.badge-error { background: rgba(232,23,58,0.12); color: var(--red); }

/* Status Badge */
.status-active {
    color: var(--green);
    font-weight: 600;
}

.status-inactive {
    color: var(--gray-400);
    font-weight: 600;
}

/* Tables */
.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

table thead th {
    background: var(--gray-50);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--gray-500);
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}

table tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--gray-100);
    vertical-align: middle;
}

table tbody tr:hover {
    background: var(--gray-50);
}

table tbody tr.row-warning {
    background: rgba(232,23,58,0.04);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 6px;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.4;
    white-space: nowrap;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

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

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

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

.btn-secondary:hover {
    background: #0d0d1d;
    color: var(--white);
}

.btn-outline {
    background: transparent;
    color: var(--gray-600);
    border: 1px solid var(--gray-200);
}

.btn-outline:hover {
    border-color: var(--gray-300);
    background: var(--gray-50);
    color: var(--gray-700);
}

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

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

.btn-sm {
    padding: 5px 12px;
    font-size: 0.78rem;
}

.btn-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Forms */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--gray-600);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-family: var(--font);
    font-size: 0.9rem;
    color: var(--gray-700);
    background: var(--white);
    transition: border-color var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(232,23,58,0.1);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23333' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 36px;
}

.form-inline {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-inline .form-group {
    margin-bottom: 0;
}

.form-hint {
    font-size: 0.78rem;
    color: var(--gray-400);
    margin-top: 4px;
}

.password-toggle {
    position: relative;
}

.password-toggle .toggle-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    font-size: 0.8rem;
    font-family: var(--font);
}

/* Alerts */
.alert {
    padding: 14px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert-success {
    background: rgba(39,174,96,0.1);
    color: #1a7a42;
    border: 1px solid rgba(39,174,96,0.2);
}

.alert-error {
    background: rgba(232,23,58,0.08);
    color: #a31230;
    border: 1px solid rgba(232,23,58,0.15);
}

.alert-info {
    background: rgba(41,128,185,0.08);
    color: #1a5276;
    border: 1px solid rgba(41,128,185,0.15);
}

.alert-warning {
    background: rgba(243,156,18,0.1);
    color: #7d6608;
    border: 1px solid rgba(243,156,18,0.2);
}

/* Sort Controls */
.sort-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 0.85rem;
}

.sort-controls span {
    color: var(--gray-400);
    font-weight: 500;
}

.sort-controls a {
    padding: 5px 12px;
    border-radius: 20px;
    color: var(--gray-500);
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition);
    font-size: 0.82rem;
}

.sort-controls a:hover,
.sort-controls a.active {
    background: var(--secondary);
    color: var(--white);
    text-decoration: none;
}

/* Stat Blocks */
.stat-blocks {
    display: flex;
    gap: 20px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.stat-block {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px 32px;
    text-align: center;
    min-width: 140px;
}

.stat-block-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--secondary);
    line-height: 1.2;
}

.stat-block-label {
    font-size: 0.78rem;
    color: var(--gray-400);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
    margin-top: 24px;
    flex-wrap: wrap;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gray-500);
    text-decoration: none;
    transition: all var(--transition);
    border: 1px solid var(--gray-200);
    background: var(--white);
}

.page-link:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
    text-decoration: none;
}

.page-link.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* Modals */
.modal-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-backdrop.open {
    display: flex;
}

.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    margin: 20px;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-100);
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--secondary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--gray-400);
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

.modal-close:hover {
    color: var(--gray-700);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--gray-100);
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--secondary);
}

.login-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    margin: 20px;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo .logo-didit {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
}

.login-logo .logo-separator {
    color: var(--gray-300);
    font-size: 1.8rem;
    font-weight: 300;
}

.login-logo .logo-app {
    font-size: 1.6rem;
    font-weight: 500;
    color: var(--secondary);
}

.login-card h2 {
    text-align: center;
    margin-bottom: 24px;
    color: var(--secondary);
    font-size: 1.2rem;
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 320px;
    margin-bottom: 28px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
}

/* Actions Panel */
.actions-panel {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 28px;
}

.actions-panel h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 16px;
}

/* Info Notice */
.info-notice {
    background: rgba(41,128,185,0.06);
    border: 1px solid rgba(41,128,185,0.15);
    border-radius: var(--radius);
    padding: 14px 20px;
    font-size: 0.85rem;
    color: #1a5276;
    margin-bottom: 20px;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-bar a {
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--gray-500);
    border: 1px solid var(--gray-200);
    text-decoration: none;
    transition: all var(--transition);
}

.filter-bar a:hover,
.filter-bar a.active {
    background: var(--secondary);
    color: var(--white);
    border-color: var(--secondary);
    text-decoration: none;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    display: inline-block;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--gray-200);
    border-radius: 24px;
    transition: var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: var(--white);
    border-radius: 50%;
    transition: var(--transition);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--green);
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .main-content {
        margin-left: 0;
        padding: 20px;
    }

    .site-grid {
        grid-template-columns: 1fr;
    }

    .summary-bar {
        grid-template-columns: 1fr;
    }

    .stat-blocks {
        flex-direction: column;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-inline {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Utility */
.text-muted { color: var(--gray-400); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-2 { gap: 16px; }
.hidden { display: none; }
