/* ===== GENERAL STYLES ===== */
body {
    font-family: Arial, sans-serif;
    background-color: #f4f4f4;
    text-align: center;
    margin: 0;
    padding: 0;
}

.container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
    padding-top: 5vh;
    /* Reduced from 10vh */
}

/* ===== CENTERED CONTAINERS ===== */

.message {
    color: red;
    margin-top: 10px;
    font-size: 14px;
}

.file-input {
    width: 100%;
    padding: 6px;
    font-size: 14px;
}

.candidate-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.section-container {
    max-width: 500px;
    margin: 20px auto;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.login-container,
.dashboard-container,
.candidate-list-container,
.add-candidate-container,
.voting-settings-container,
.section-container,
.admin-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
    margin: 20px auto;
    text-align: center;
}

.login-container,
.dashboard-container {
    width: 40%;
    margin-top: 100px;
}

.candidate-list-container,
.add-candidate-container,
.voting-settings-container,
.section-container {
    width: 50%;
    max-width: 600px;
    border: 1px solid #ccc;
    background: #f9f9f9;
}

.admin-section {
    max-width: 500px;
}

/* ===== FORM ELEMENTS ===== */
input,
button {
    width: 90%;
    padding: 12px;
    margin: 10px 0;
    border-radius: 5px;
    border: 1px solid #ccc;
}

button {
    background-color: blue;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.3s ease;
}

button:hover {
    background-color: darkblue;
}

.admin-btn {
    background-color: blue;
}

.user-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 60%;
    cursor: pointer;
    font-size: 16px;
}

.user-btn:hover {
    background-color: #2980b9;
}

.logout-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 60%;
    cursor: pointer;
    font-size: 16px;
}

.logout-btn:hover {
    background-color: #2980b9;
}

/* ===== TABLE STYLES ===== */
.table-container {
    width: 100%;
    margin: 1rem auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.5rem;
    box-sizing: border-box;
}

table {
    border-collapse: collapse;
    width: auto;
    margin: 0 auto;
    font-size: 1rem;
}

th,
td {
    padding: 0.75rem;
    text-align: center;
    border: 1px solid #ddd;
    white-space: nowrap;
    /* Prevent line breaks */
    min-width: 100px;
    /* Minimum column width */
}

th {
    background-color: #3498db;
    color: white;
    position: sticky;
    top: 0;
    /* For vertical scrolling */
}

tr:nth-child(even) {
    background-color: #f8f8f8;
}

tr:nth-child(odd) {
    background-color: #ffffff;
}

.top-candidate {
    font-weight: bold;
    background-color: #ffd700;
}

/* ===== MODAL STYLES ===== */
.modal {
    display: block;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    width: 100%;
    max-width: 400px;
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
    margin: 20px auto;
    /* Added margin */
    text-align: center;
    position: relative;
}

/* ===== LOGO STYLES ===== */
.logo-container {
    margin: 0 auto;
    padding: 10px 0;
    /* Reduced padding */
    width: 100%;
    max-width: 250px;
    /* Slightly smaller max-width */
    text-align: center;
}

.logo {
    width: 100%;
    height: auto;
    max-height: 220px;
    object-fit: contain;
}

/* ===== PAGINATION ===== */
.pagination {
    margin-top: 10px;
    text-align: center;
}

.pagination a {
    padding: 8px 12px;
    margin: 2px;
    text-decoration: none;
    background-color: #3498db;
    color: white;
    border-radius: 5px;
}

.pagination a:hover {
    background-color: #2980b9;
}

.pagination span {
    padding: 8px 16px;
    background-color: #3498db;
}

/* ===== PRINT STYLES ===== */
@media print {
    body * {
        visibility: hidden;
    }

    .vote-container,
    .vote-container * {
        visibility: visible;
    }

    .vote-container {
        position: absolute;
        top: 0;
        left: 0;
        width: 5.5in;
        height: 2.75in;
        padding: 10px;
        font-size: 14px;
        border: 1px solid black;
    }

    .vote-container button {
        display: none;
    }

    .table-responsive-container {
        overflow: visible;
        border: none;
        box-shadow: none;
    }

    .voter-data-table {
        min-width: 100%;
        page-break-inside: avoid;
    }

    .action-buttons {
        display: none;
    }

    .voter-data-table th,
    .voter-data-table td {
        padding: 6px 4px;
        font-size: 0.8em;
    }
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 1024px) {

    .login-container,
    .dashboard-container {
        width: 60%;
        margin-top: 80px;
    }

    .voter-table {
        display: block;
        width: 100%;
        overflow-x: auto;
    }

    .voter-table th,
    .voter-table td {
        white-space: nowrap;
        min-width: 100px;
        /* Prevent column squishing */
        padding: 8px 10px;
        font-size: 0.85rem;
    }

    .actions {
        min-width: 160px;
        /* Reduced for tablets */
    }

    .action-buttons {
        gap: 3px;
        /* Tighter spacing */
    }

    .btn-edit,
    .btn-delete,
    .btn-print {
        padding: 5px 6px;
        font-size: 0.75rem;
        min-width: 55px;
    }
}

@media (max-width: 768px) {

    .login-container,
    .dashboard-container,
    .candidate-list-container,
    .add-candidate-container,
    .voting-settings-container,
    .section-container {
        width: 80%;
    }

    .table-container {
        justify-content: flex-start;
    }

    table {
        width: auto;
        /* Maintain natural width */
        min-width: 0;
        /* Remove minimum width constraint */
    }

    th,
    td {
        white-space: nowrap;
        /* Prevent line breaks in cells */
    }

    .container {
        .container {
            gap: 10px;
            /* Even smaller gap on tablets */
            padding-top: 3vh;
            /* Less top padding */
        }

        .logo-container {
            margin-top: 15px;
        }

        .logo {
            max-height: 180px;
            /* Slightly smaller logo */
        }

        .modal-content {
            width: 100%;
            max-width: 400px;
            background: white;
            padding: 20px;
            /* Reduced from 30px */
            border-radius: 10px;
            box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.1);
            margin: 0 auto;
            /* Removed extra margin */
            text-align: center;
        }

        .voter-data-table {
            font-size: 0.9em;
            min-width: 800px;
            /* Reduced minimum width */
        }
    }

    .form-row {
        gap: 10px;
        /* Reduced gap for mobile */
    }

    .submit-btn {
        width: 130px;
        /* Slightly smaller on mobile */
    }

    .voter-section {
        padding: 20px;
    }

    .voter-management-container {
        padding: 15px;
    }

    .form-row .form-group {
        margin-bottom: 12px;
        /* Slightly less space on mobile */
    }

    .form-row .form-group:first-child {
        margin-right: 0;
        /* Remove extra space on mobile */
    }

    .form-row input,
    .form-row select {
        height: 36px;
        /* Slightly smaller on mobile */
    }

    input[name="contact_number"] {
        width: 100%;
        /* Full width on mobile */
        max-width: 100%;
    }

    .voter-list-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .action-buttons {
        flex-direction: row;
        /* Keep buttons in row */
        justify-content: center;
        /* Center buttons */
    }

    .voter-table th,
    .voter-table td {
        padding: 6px 8px;
        font-size: 0.8rem;
    }

    .search-row {
        flex-wrap: wrap;
    }

    .search-select,
    .search-input {
        min-width: 100%;
    }

    .search-btn,
    .reset-btn {
        width: 48%;
        /* Side-by-side on mobile */
        margin: 1%;
    }

    .actions {
        min-width: 140px;
        /* Further reduced for phones */
    }

    .btn-edit,
    .btn-delete,
    .btn-print {
        padding: 4px 5px;
        font-size: 0.7rem;
        min-width: 50px;
    }

    /* Make delete button slightly more prominent */
    .delete-all-btn {
        padding: 8px 12px;
        width: 160px;
    }

    input[type="text"],
    .user-btn {
        width: 80%;
    }

    .voter-form {
        padding: 15px;
    }

    .voter-input,
    .voter-btn {
        width: 80%;
    }

    .login-btn {
        width: 160px;
        padding: 12px 18px;
        font-size: 15px;
    }
}

@media (max-width: 480px) {

    .login-container,
    .dashboard-container,
    .candidate-list-container,
    .add-candidate-container,
    .voting-settings-container,
    .section-container {
        width: 90%;
        margin-top: 40px;
        padding: 15px;
    }

    .container {
        gap: 8px;
        /* Smallest gap on phones */
        padding-top: 2vh;
    }

    .logo {
        max-height: 100px;
    }

    .modal-content {
        padding: 15px;
    }

    .voter-section {
        padding: 15px;
    }

    input,
    select {
        padding: 8px;
    }

    .submit-btn {
        padding: 10px 15px;
    }

    .form-input {
        width: 100%;
        /* Full width on small screens */
        max-width: 300px;
        /* But not too wide */
    }

    input[type="text"],
    .user-btn {
        width: 90%;
        padding: 10px;
        font-size: 14px;
    }

    .voter-form label {
        font-size: 14px;
    }

    .voter-input,
    .voter-btn {
        width: 90%;
        padding: 10px;
        font-size: 14px;
    }

    .login-btn {
        width: 100%;
        max-width: 280px;
        padding: 14px;
        font-size: 16px;
        margin: 0 auto;
        display: block;
    }
}

/* Very small smartphones */
@media (max-width: 320px) {
    .login-btn {
        padding: 12px;
        font-size: 15px;
    }
}

/* SMARTPHONE OPTIMIZATION (Portrait) */
@media (max-width: 600px) and (orientation: portrait) {
    .table-container {
        display: block;
        max-height: 70vh;
        /* Limit height for vertical scrolling */
        overflow-y: auto;
    }

    table {
        display: block;
        width: max-content;
        /* Allow horizontal expansion */
    }

    th,
    td {
        padding: 0.5rem 0.3rem;
        font-size: 0.85rem;
    }

    .container {
        padding-top: 5vh;
        /* Less push on phones */
        gap: 20px;
    }

    .logo-container {
        margin-top: 10px;
    }

    .modal-content {
        top: 10px;
        margin: 10px auto;
        padding: 20px;
    }
}

/* TABLET OPTIMIZATION */
@media (min-width: 601px) and (max-width: 1024px) {
    .table-container {
        max-width: 95vw;
    }

    th,
    td {
        white-space: normal;
        /* Allow wrapping on tablets */
        word-break: break-word;
        padding: 0.6rem;
    }
}

/* LANDSCAPE ORIENTATION */
@media (max-width: 1024px) and (orientation: landscape) {
    .table-container {
        max-height: 80vh;
        overflow-y: auto;
    }

    table {
        width: auto;
    }

    th,
    td {
        min-width: auto;
        white-space: normal;
    }
}

/* SPECIAL CASES FOR VERY SMALL SCREENS */
@media (max-width: 400px) {

    th,
    td {
        padding: 0.4rem 0.2rem;
        font-size: 0.8rem;
        min-width: 80px;
    }
}

/* ===== LANDSCAPE ORIENTATION STYLES ===== */
@media (orientation: landscape) {
    .table-container {
        max-width: 100%;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0.25rem;
    }

    table {
        width: 100%;
        table-layout: auto;
        font-size: 0.9rem;
    }

    th,
    td {
        white-space: nowrap;
        padding: 0.5rem 0.75rem;
        min-width: 0;
    }
}

/* ===== SMALL LANDSCAPE DEVICES (Mobile phones) ===== */
@media (orientation: landscape) and (max-height: 500px) {
    .table-container {
        max-height: 70vh;
        padding: 0.3rem;
    }

    th,
    td {
        padding: 0.3rem;
        font-size: 0.8rem;
    }

    /* Force compact view for very small landscape */
    table {
        table-layout: fixed;
        /* Equal column distribution */
    }
}

/* ===== TABLET LANDSCAPE OPTIMIZATION ===== */
@media (orientation: landscape) and (min-width: 768px) {
    .table-container {
        max-width: 95vw;
    }

    table {
        font-size: 1rem;
    }

    th,
    td {
        white-space: normal;
    }
}

/* ===== TINY PHONE LANDSCAPE (Galaxy Fold, etc) ===== */
@media (orientation: landscape) and (max-width: 500px) {

    th,
    td {
        font-size: 0.7rem;
        padding: 3px 4px;
    }
}

/* ===== SMALL PHONE LANDSCAPE (Very narrow) ===== */
@media (orientation: landscape) and (max-width: 700px) {

    th,
    td {
        font-size: 0.75rem;
        padding: 4px 6px;
        min-width: 50px !important;
    }
}

@media (orientation: landscape) and (max-width: 900px) {
    .table-container {
        -webkit-overflow-scrolling: touch;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 4px;
        max-height: 75vh;
    }

    table {
        width: auto;
        table-layout: fixed;
        /* Ensures consistent column widths */
    }

    th,
    td {
        word-break: break-word;
        /* Break long words */
        overflow-wrap: anywhere;
        /* Emergency break for long strings */
        white-space: normal;
        /* Allow text wrapping */
        min-width: 60px !important;
        /* Minimum reasonable width */
        max-width: 200px;
        /* Prevent excessive widening */
        padding: 6px 8px;
        font-size: 0.85rem;
    }

    /* Add visual indicators for scrollable tables */
    .table-container::-webkit-scrollbar {
        height: 6px;
    }
}

/* ===== SMALL PHONE LANDSCAPE (Very narrow) ===== */
@media (orientation: landscape) and (max-width: 700px) {

    th,
    td {
        font-size: 0.75rem;
        padding: 4px 6px;
        min-width: 50px !important;
    }
}

.table-responsive-container {
    width: 100%;
    margin: 20px 0;
    overflow-x: auto;
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background: white;
    -webkit-overflow-scrolling: touch;
}

/* ===== VOTER TABLE ===== */
.voter-data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
    min-width: fit-content;
    /* Changed from fixed pixel width */
}

.voter-data-table th,
.voter-data-table td {
    padding: 12px 10px;
    border: 1px solid #e0e0e0;
    word-break: break-word;
    overflow-wrap: break-word;
    vertical-align: top;
}

.voter-data-table th {
    background-color: #4CAF50;
    color: white;
    position: sticky;
    top: 0;
    text-align: center;
    font-weight: bold;
    white-space: nowrap;
}

.voter-data-table tr:nth-child(even) {
    background-color: #f9f9f9;
}

.voter-data-table tr:hover {
    background-color: #f0f0f0;
}

/* ===== COLUMN WIDTHS ===== */
.voter-data-table th:nth-child(1),
.voter-data-table td:nth-child(1) {
    width: auto;
    /* Changed from fixed width */
    min-width: 40px;
}

.voter-data-table th:nth-child(2),
.voter-data-table td:nth-child(2),
.voter-data-table th:nth-child(3),
.voter-data-table td:nth-child(3) {
    width: auto;
    min-width: 100px;
}

.voter-data-table th:nth-child(4),
.voter-data-table td:nth-child(4) {
    width: auto;
    min-width: 90px;
}

.voter-data-table th:nth-child(5),
.voter-data-table td:nth-child(5) {
    width: auto;
    min-width: 60px;
}

.voter-data-table th:nth-child(6),
.voter-data-table td:nth-child(6),
.voter-data-table th:nth-child(7),
.voter-data-table td:nth-child(7) {
    width: auto;
    min-width: 70px;
}

.voter-data-table th:nth-child(8),
.voter-data-table td:nth-child(8) {
    width: auto;
    min-width: 100px;
}

.voter-data-table th:nth-child(9),
.voter-data-table td:nth-child(9) {
    width: auto;
    min-width: 80px;
}

.voter-data-table th:nth-child(10),
.voter-data-table td:nth-child(10) {
    width: auto;
    min-width: 120px;
}

.voter-data-table th:nth-child(11),
.voter-data-table td:nth-child(11) {
    width: auto;
    min-width: 140px;
}

.voter-data-table th:nth-child(12),
.voter-data-table td:nth-child(12) {
    width: auto;
    min-width: 180px;
}

/* ===== ACTION BUTTONS ===== */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.btn-edit,
.btn-delete,
.btn-print {
    padding: 6px 8px;
    /* Slightly reduced padding */
    font-size: 0.8rem;
    /* Slightly smaller font */
    min-width: 60px;
    /* Minimum width for all buttons */
    text-align: center;
}

.btn-edit {
    background-color: #2196F3;
    color: white;
    border: none;
}

.btn-delete {
    background-color: #f44336;
    color: white;
    border: none;
}

.btn-print {
    background-color: #4CAF50;
    color: white;
    border: none;
    cursor: pointer;
}

@media (max-width: 1200px) {
    .voter-data-table {
        font-size: 0.95em;
    }

    .voter-data-table th,
    .voter-data-table td {
        padding: 10px 8px;
    }
}

@media (max-width: 992px) {
    .action-buttons {
        flex-direction: column;
        gap: 4px;
    }

    .btn-edit,
    .btn-delete,
    .btn-print {
        width: 100%;
    }
}

@media (max-width: 576px) {
    .voter-data-table {
        min-width: 700px;
        /* Further reduced minimum width */
    }

    .voter-list-container {
        padding: 15px;
    }

    .voter-table {
        min-width: 800px;
    }

    .table-wrapper {
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

.logo-upload-container {
    max-width: 500px;
    margin: 20px auto;
    padding: 25px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.logo-upload-form h3 {
    margin-top: 0;
    color: #333;
    text-align: center;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-group input[type="file"] {
    width: 80%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f9f9f9;
}

.upload-btn {
    width: 50%;
    padding: 12px;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.upload-btn:hover {
    background-color: #2980b9;
}

@media (max-width: 600px) {
    .logo-upload-container {
        padding: 15px;
        margin: 15px;
    }

    .form-row {
        flex-direction: column;
    }

    .form-input,
    .submit-btn {
        width: 100%;
    }

    .settings-form {
        max-width: 100%;
    }

    .settings-input {
        max-width: 120px;
    }

    .settings-btn {
        width: 120px;
    }
}

/* Settings Form Styles */
.settings-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 300px;
    margin: 15px auto 0;
    /* Center the form */
}

.form-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Centers both inputs and button */
    gap: 5px;
}

.settings-input {
    width: 150px;
    /* Fixed width */
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
    /* Center input text */
}

.button-container {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.settings-btn {
    padding: 8px 15px;
    background-color: #3498db;
    /* Same green as Add Candidate */
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    width: 150px;
    transition: background-color 0.3s;
    justify-content: center;
    align-items: center;
    margin-left: 2px;
}

.settings-btn:hover {
    background-color: #2980b9;
    /* Darker green on hover */
}

/* Main Container */
.voter-management-container {
    max-width: 900px;
    margin: 30px auto;
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Sections */
.voter-section {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 25px;
    margin-bottom: 30px;
    margin-top: 30px;
}

.voter-section h2 {
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 1.5rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

/* Forms */
.voter-form,
.csv-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-row {
    display: flex;
    gap: 15px;
    /* Reduced from 20px */
    margin-bottom: 10px;
    /* Added bottom margin */
}

.form-group {
    flex: 1;
    margin-bottom: 5px;
    /* Reduced from 10px */
}

.form-group.full-width {
    flex: 0 0 100%;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
    font-size: 0.9rem;
}

/* Update input/select fields */
input[type="text"],
input[type="date"],
input[type="file"],
select {
    width: 100%;
    padding: 8px 10px;
    /* Reduced vertical padding */
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    margin-bottom: 5px;
    /* Added bottom margin */
}

input[type="file"] {
    padding: 8px;
}

small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 0.8rem;
}

/* Buttons */
.submit-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 10px 15px;
    /* Reduced padding */
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background-color 0.3s;
    margin: 15px auto;
    /* Centered with auto margins */
    display: block;
    /* Needed for auto margins to work */
    width: 150px;
    /* Fixed width */
}

.submit-btn:hover {
    background-color: #2980b9;
}

.form-row .form-group {
    margin-bottom: 15px;
    /* Increased space between rows */
}

/* Add extra space between paired fields */
.form-row .form-group:first-child {
    margin-right: 15px;
    /* Space between First/Last name, etc. */
}

.form-row input,
.form-row select {
    height: 38px;
    /* Fixed height for alignment */
    box-sizing: border-box;
    /* Include padding in height */
}

/* Adjust select dropdown styling to match input fields */
.form-row select {
    padding: 8px 10px;
    /* Match input padding */
    appearance: none;
    /* Remove default dropdown styling */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23333333'%3e%3cpath d='M7 10l5 5 5-5z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 12px;
}

.form-group.full-width {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Center horizontally */
}

input[name="contact_number"] {
    width: 60%;
    /* Narrower width */
    max-width: 250px;
    margin: 0 auto;
    /* Extra centering assurance */
}

.form-group {
    margin-bottom: 15px;
}

.form-input {
    width: 200px;
    /* Reduced width */
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
    /* Includes padding in width */
}

.admin-input {
    width: 200px;
    /* Reduced width */
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
    /* Includes padding in width */
}

/* Main Container */
.voter-list-container {
    max-width: 1275px;
    margin: 20px auto;
    padding: 20px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Header */
.voter-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.voter-list-header h2 {
    color: #2c3e50;
    margin: 0;
}

.back-btn {
    color: #3498db;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 8px 12px;
    border: 1px solid #3498db;
    border-radius: 4px;
    transition: all 0.3s;
    font-weight: bold;
}

.back-btn:hover {
    background-color: #3498db;
    color: white;
}

/* Alerts */
.alert {
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.alert.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Search Form */
.search-container {
    margin-bottom: 20px;
    background: #f8f9fa;
    padding: 15px;
    border-radius: 5px;
}

.search-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.search-select,
.search-input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    flex: 1;
    min-width: 150px;
}

.search-btn,
.reset-btn {
    padding: 10px 15px;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
    width: 120px;
    /* Fixed width */
    text-align: center;
    display: inline-block;
    /* For consistent alignment */
}

.search-btn {
    background-color: #3498db;
    color: white;
    border: none;
}

.reset-btn {
    background-color: #6c757d;
    color: white;
    text-decoration: none;
    border: none;
    margin-left: 5px;
    /* Small gap between buttons */
}

/* Delete All Button */
.action-container {
    margin: 20px 0;
    display: flex;
    justify-content: center;
    /* This centers the button */
    width: 100%;
}

.delete-all-btn {
    background-color: #dc3545;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    width: 180px;
    /* Reduced from auto */
    text-align: center;
}

.delete-all-btn:hover {
    background-color: #c82333;
}

/* Table Styles */
.table-wrapper {
    overflow-x: auto;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    margin-bottom: 20px;
    background: white;
}

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

.voter-table th,
.voter-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.voter-table th {
    background-color: #343a40;
    color: white;
    position: sticky;
    top: 0;
}

.voter-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.voter-table tr:hover {
    background-color: #e9ecef;
}

/*  Buttons */
.action-buttons {
    display: flex;
    gap: 5px;
    max-width: 30px;
}

.btn-edit,
.btn-delete,
.btn-print {
    padding: 6px 10px;
    font-size: 0.85rem;
    border-radius: 3px;
    text-decoration: none;
    white-space: nowrap;
    justify-content: center;
}

.btn-edit {
    background-color: #17a2b8;
    color: white;
    border: none;
}

.btn-delete {
    background-color: #dc3545;
    color: white;
    border: none;
}

.btn-print {
    background-color: #28a745;
    color: white;
    border: none;
    cursor: pointer;
}

.actions {
    white-space: nowrap;
    min-width: 180px;
    /* Ensure enough space for buttons */
}

.export-excel-btn {
    background-color: #28a745;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    width: 180px;
    /* Reduced from auto */
    text-align: center;
    margin-left: 4px;
}

.export-excel-btn:hover {
    background-color: #218838;
}

form {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.voter-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    box-sizing: border-box;
}

.voter-form label {
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: bold;
    color: #333;
    width: 100%;
    text-align: center;
}

.voter-input {
    width: 60%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    text-align: center;
    box-sizing: border-box;
}

.voter-btn {
    width: 60%;
    padding: 12px;
    background-color: #2980b9;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}

.voter-btn:hover {
    background-color: #3498db;
}

.login-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    width: 20%;
    cursor: pointer;
    font-size: 16px;
    text-align: center;
    justify-content: center;
}

.login-btn:hover {
    background-color: #2980b9;
}

/* iPad (portrait and landscape) */
@media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
    .login-btn {
        width: 180px;
        padding: 14px 22px;
        font-size: 17px;
    }
}