/* RESET */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Poppins", sans-serif;
}

body {
    background: #f4f5f7;
    padding: 20px;
}

/* HEADER */
.top-header {
    text-align: center;
    margin-bottom: 30px;
}

.top-header h1 {
    font-size: 2.2rem;
    font-weight: 800;
}

.top-header p {
    margin-top: 8px;
    color: #444;
}

/* TABS */
.tabs {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
    gap: 12px;
}

.tab {
    padding: 10px 25px;
    border-radius: 25px;
    background: #d9d9d9;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: 0.3s;
}

.tab.active {
    background: #007bff;
    color: white;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

/* CATEGORY TITLE */
.category-title {
    text-align: center;
    font-size: 28px;
    margin: 30px 0 40px;
    font-weight: bold;
    color: #222;
}

/* MAIN CONTAINER */
.card-container {
    max-width: 1200px;
    margin: auto;
}

/* PANELS */
.category-panel {
    display: none;
    width: 100%;
}

.category-panel.active {
    display: block;
}

/* CARD CENTERING WRAPPER */
.cards-wrapper {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 40px;
    width: 100%;
}

/* CARD */
.card {
    width: 500px;
    position: relative;
    background: #fff;
    padding: 80px 20px 20px;
    border-radius: 18px;
    margin: 60px 0;
    text-align: center;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
    transition: 0.3s ease;
}

.card:hover {
    transform: translateY(-6px);
}

/* IMAGE */
.img-wrap {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    overflow: hidden;
    position: absolute;
    top: -65px;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* INFO */
.info h4 {
    margin: 8px 0;
    color: #444;
}

/* VOTE BUTTON */
.vote-btn {
    margin-top: 10px;
    padding: 12px 25px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: 0.3s ease;
}

.vote-btn:hover {
    background: #0056b3;
    transform: scale(1.07);
}

/* FOOTER */
.footer {
    margin-top: 50px;
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 0.9rem;
}

/* Admin responsive layout */
.main-content {
    margin-top: 1.5rem;
    padding: 1rem;
}

/* Ensure sidebar doesn't overlap on larger screens */
@media (min-width: 992px) {
    .main-content {
        margin-left: 280px;
    }
}

@media (min-width: 768px) and (max-width: 991px) {
    .main-content {
        margin-left: 250px;
        padding: 1rem;
    }
}

@media (max-width: 767px) {
    .main-content {
        margin-left: 0;
        padding: 0.75rem;
    }
}

/* Ensure sidebar is positioned fixed without overlap */
.sidebar {
    position: fixed !important;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    padding-bottom: 20px;
    scroll-behavior: smooth;
}

/* Sidebar scrollbar styling */
.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Mobile: hide sidebar by default */
@media (max-width: 767px) {
    .sidebar {
        width: 100%;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
}

/* Responsive forms and tables */
.form-control, .form-select {
    font-size: 1rem;
    padding: 0.75rem;
}

@media (max-width: 576px) {
    .form-control, .form-select {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* Responsive button groups */
.btn {
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    white-space: nowrap;
}

.btn-sm {
    padding: 0.35rem 0.65rem;
    font-size: 0.85rem;
}

@media (max-width: 576px) {
    .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    
    .btn-group {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
}

/* Responsive tables */
.table {
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.table thead th {
    font-weight: 600;
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

@media (max-width: 768px) {
    .table {
        font-size: 0.85rem;
    }
    
    .table thead {
        display: none;
    }
    
    .table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #dee2e6;
        border-radius: 0.375rem;
    }
    
    .table tbody td {
        display: block;
        text-align: right;
        padding-left: 50%;
        position: relative;
    }
    
    .table tbody td:before {
        content: attr(data-label);
        position: absolute;
        left: 0.75rem;
        font-weight: 600;
        text-align: left;
    }
}

/* Form grid responsiveness */
.row.g-3 {
    margin-bottom: 1.5rem;
}

@media (max-width: 576px) {
    .col-md-2, .col-md-3, .col-md-4, .col-md-6 {
        min-width: 100%;
    }
    
    .row > [class*='col-'] {
        margin-bottom: 0.75rem;
    }
}

@media (min-width: 577px) and (max-width: 768px) {
    .col-md-2 {
        flex: 0 0 calc(50% - 0.75rem);
    }
    
    .col-md-3 {
        flex: 0 0 calc(50% - 0.75rem);
    }
    
    .col-md-4 {
        flex: 0 0 calc(50% - 0.75rem);
    }
}

/* Responsive containers */
.container, .container-lg, .container-md {
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (max-width: 576px) {
    .container, .container-lg, .container-md {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
}

/* Responsive alert messages */
.alert {
    margin-bottom: 1rem;
    border-radius: 0.375rem;
    font-size: 0.95rem;
}

@media (max-width: 576px) {
    .alert {
        font-size: 0.85rem;
        padding: 0.75rem;
    }
}

/* Responsive badge */
.badge {
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
    display: inline-block;
}

@media (max-width: 576px) {
    .badge {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
}

/* Responsive search/filter forms */
.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 576px) {
    .filter-form {
        flex-direction: column;
    }
    
    .filter-form input, .filter-form select, .filter-form button {
        width: 100%;
    }
}
