:root {
    --primary: #4e73df;
    --primary-dark: #3a56b0;
    --primary-light: #7c9aff;
    --secondary: #858796;
    --success: #1cc88a;
    --info: #36b9cc;
    --warning: #f6c23e;
    --danger: #e74a3b;
    --light: #f8f9fc;
    --dark: #2c3e50;
    --sidebar-bg: linear-gradient(180deg, #3a56b0 0%, #2c3e50 100%);
    --sidebar-width: 250px;
    --sidebar-collapsed-width: 0px;
    --topbar-height: 60px;
    --border-radius: 0.5rem;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0,0,0,0.06);
    --shadow: 0 0.25rem 0.75rem rgba(0,0,0,0.08);
    --shadow-lg: 0 0.5rem 1.5rem rgba(0,0,0,0.1);
    --transition: all 0.25s ease;
}

/* Base */
body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--light);
    overflow-x: hidden;
}

/* Layout */
#app-wrapper {
    display: flex;
    min-height: 100vh;
}

#sidebar-wrapper {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    transition: var(--transition);
}

#content-wrapper {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

#main-content {
    flex: 1;
    padding: 1.5rem;
}

/* Sidebar */
.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 1.25rem 1rem;
    color: #fff;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sidebar-brand:hover {
    color: #fff;
}

.sidebar-brand i {
    font-size: 1.3rem;
    margin-right: 0.75rem;
    opacity: 0.9;
}

.sidebar-heading {
    padding: 0.75rem 1rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.4);
}

.sidebar-nav .nav-item {
    margin: 2px 0.5rem;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    padding: 0.65rem 0.75rem;
    color: rgba(255,255,255,0.7);
    border-radius: var(--border-radius);
    transition: var(--transition);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
}

.sidebar-nav .nav-link i {
    width: 1.5rem;
    text-align: center;
    margin-right: 0.65rem;
    font-size: 0.9rem;
}

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

.sidebar-nav .nav-link.active {
    color: #fff;
    background: rgba(255,255,255,0.15);
}

.sidebar-divider {
    border-top: 1px solid rgba(255,255,255,0.1);
    margin: 0.5rem 1rem;
}

/* Topbar */
.topbar {
    height: var(--topbar-height);
    background: #fff;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.topbar .page-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--dark);
    margin: 0;
}

.topbar .dropdown-toggle::after {
    display: none;
}

.topbar .user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--secondary);
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.topbar .user-info:hover {
    background: var(--light);
}

.topbar .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

/* Cards */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

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

.card-header {
    background: #fff;
    border-bottom: 1px solid rgba(0,0,0,0.06);
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

/* Stat Cards */
.stat-card {
    border: none;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    color: #fff;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
}

.stat-card .stat-icon {
    font-size: 2rem;
    opacity: 0.8;
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
}

.stat-card .stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.85;
    margin-bottom: 0.25rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
}

.stat-card.bg-primary-gradient { background: linear-gradient(135deg, #4e73df 0%, #224abe 100%); }
.stat-card.bg-success-gradient { background: linear-gradient(135deg, #1cc88a 0%, #13855c 100%); }
.stat-card.bg-info-gradient { background: linear-gradient(135deg, #36b9cc 0%, #258391 100%); }
.stat-card.bg-warning-gradient { background: linear-gradient(135deg, #f6c23e 0%, #dda20a 100%); }
.stat-card.bg-danger-gradient { background: linear-gradient(135deg, #e74a3b 0%, #be2617 100%); }

/* Tables */
.table {
    margin-bottom: 0;
}

.table thead th {
    background: var(--light);
    border-bottom: 2px solid #e3e6f0;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--secondary);
    padding: 0.75rem 1rem;
    white-space: nowrap;
}

.table tbody td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-color: #f0f0f5;
    font-size: 0.9rem;
}

.table tbody tr:hover {
    background-color: rgba(78, 115, 223, 0.03);
}

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

.badge-active, .badge-enabled, .badge-approved, .badge-admin {
    background-color: rgba(28, 200, 138, 0.12);
    color: #13855c;
}

.badge-inactive, .badge-disabled, .badge-declined, .badge-block {
    background-color: rgba(231, 74, 59, 0.12);
    color: #be2617;
}

.badge-user {
    background-color: rgba(54, 185, 204, 0.12);
    color: #258391;
}

/* Buttons */
.btn {
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: var(--transition);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
}

.btn-action {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.8rem;
}

/* Forms */
.form-control, .form-select {
    border-radius: var(--border-radius);
    border-color: #d1d3e2;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.15);
}

.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--dark);
    margin-bottom: 0.35rem;
}

/* Alerts */
.alert {
    border: none;
    border-radius: var(--border-radius);
    font-size: 0.9rem;
}

/* Pagination */
.pagination {
    gap: 0.25rem;
}

.pagination .page-link {
    border-radius: var(--border-radius) !important;
    border: none;
    color: var(--primary);
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary);
    color: #fff;
}

/* Footer */
.admin-footer {
    padding: 1rem 1.5rem;
    text-align: center;
    font-size: 0.8rem;
    color: var(--secondary);
    border-top: 1px solid #e3e6f0;
    background: #fff;
}

/* Mobile: Sidebar as offcanvas */
@media (max-width: 991.98px) {
    #sidebar-wrapper {
        transform: translateX(-100%);
    }

    #sidebar-wrapper.show {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.4);
        z-index: 1035;
        display: none;
    }

    .sidebar-backdrop.show {
        display: block;
    }

    #content-wrapper {
        margin-left: 0;
    }

    #main-content {
        padding: 1rem;
    }

    .stat-card .stat-value {
        font-size: 1.4rem;
    }
}

/* Tablet adjustments */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .stat-card .stat-value {
        font-size: 1.5rem;
    }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--secondary);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

/* Scrollbar */
#sidebar-wrapper::-webkit-scrollbar {
    width: 4px;
}

#sidebar-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}

/* Animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* Login page */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4e73df 0%, #2c3e50 100%);
    padding: 1rem;
}

.login-card {
    max-width: 420px;
    width: 100%;
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.login-card .card-body {
    padding: 2.5rem;
    text-align: center;
}

.login-card .login-logo {
    width: 80px;
    height: 80px;
    background: var(--primary);
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: #fff;
    font-size: 2rem;
}

.login-card h4 {
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.login-card .text-muted {
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

/* Welcome page */
.welcome-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #4e73df 0%, #2c3e50 100%);
    color: #fff;
    text-align: center;
    padding: 2rem;
}

.welcome-wrapper h1 {
    font-weight: 700;
    margin-bottom: 1rem;
}

.welcome-wrapper .lead {
    opacity: 0.85;
    margin-bottom: 2rem;
}

/* Drag Handle */
.drag-handle {
    cursor: grab;
    padding: 0.5rem;
    color: var(--secondary);
    transition: var(--transition);
}

.drag-handle:hover {
    color: var(--primary);
}

.drag-handle:active {
    cursor: grabbing;
}

.sortable-ghost {
    opacity: 0.4;
    background: rgba(78, 115, 223, 0.05);
}

.sortable-chosen {
    background: rgba(78, 115, 223, 0.08);
}

/* Copy Button Success Animation */
.btn-copy {
    transition: all 0.2s ease;
}

.btn-copy.btn-success {
    border-color: var(--success) !important;
}

/* Toggle Badge Button */
.badge-toggle {
    cursor: pointer;
    border: none;
    outline: none;
    transition: var(--transition);
    background: none;
    font-family: inherit;
}

.badge-toggle:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

/* Deep Link Input Group */
.deep-link-group {
    max-width: 450px;
}

.deep-link-group .form-control {
    font-size: 0.8rem;
    font-family: 'SFMono-Regular', Consolas, monospace;
}

/* Progress Bars for Vote Distribution */
.vote-progress {
    height: 8px;
    border-radius: 4px;
    background-color: #e9ecef;
}

.vote-progress .progress-bar {
    border-radius: 4px;
    transition: width 0.6s ease;
}

/* Delete button */
.btn-delete {
    background: none;
    border: none;
    padding: 0;
}
