:root {
    --primary: #003366;
    --secondary: #990000;
    --background: #f5f5f5;
    --card-bg: #ffffff;
    --text: #333333;
}

html {
    scroll-behavior: smooth;
}

/* General styles */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.container {
    padding: 20px;
}

header {
    background: var(--primary);
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    margin: 0;
    font-size: 2rem;
}

/* Navigation Menu Styles */
nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    padding: 0;
    margin: 0;
    gap: 1rem;
    justify-content: left;
}

nav li {
    margin: 0;
}

nav a {
    display: block;
    padding: 0.5rem 1rem;
    background: var(--secondary);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: opacity 0.2s, background-color 0.2s;
}

nav a:hover {
    opacity: 0.9;
    background-color: #e70404;
}

/* Responsive Menu */
@media screen and (max-width: 768px) {
    nav ul {
        flex-direction: row; /* Stack items vertically */
        gap: 0.5rem; /* Adjust spacing for mobile */
        align-items: left; /* Center the menu */
    }

    nav a {
        width: 100%; /* Full width for touch usability */
        text-align: center;
    }
}

.sections {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

section {
    margin-bottom: 3rem;
}

section h2 {
    color: var(--primary);
    border-bottom: 2px solid var(--secondary);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: .5rem;
    padding: 1rem 0;
}

.grid-item {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s;
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 1rem;
    align-items: center;
}

.grid-item:hover {
    transform: translateY(-2px);
}

.grid-item h3 {
    margin: 0 0 0.5rem 0;
    color: var(--primary);
}

.grid-item p {
    margin: 0;
    color: var(--text);
}

.grid-item .image-container {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
}

.grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.grid-item .content {
    display: flex;
    flex-direction: column;
}

.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text);
    font-weight: 500;
}

.news-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 2rem;
}

.news-item {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.news-item h3 {
    margin: 0 0 1rem 0;
    color: var(--primary);
}

.news-item p {
    margin: 0 0 1rem 0;
    line-height: 1.5;
}

.news-item .date {
    color: #666;
    font-size: 0.9rem;
}

.news-item a {
    color: var(--primary);
    text-decoration: none;
    display: block;
    margin-top: 0.5rem;
    font-weight: 500;
    transition: color 0.2s;
}

.news-item a:hover {
    color: var(--secondary);
    text-decoration: underline;
}

.news-item .metadata {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    color: #666;
    font-size: 0.9rem;
}

/* Admin Layout */
.admin-container {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    background-color: #ffffff;  /* Ensure white background */
}

.admin-container .admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    background-color: var(--primary);
    padding: 1rem 2rem;
    border-radius: 4px;
    width: 100%;
    box-sizing: border-box;
}

.admin-container .admin-header h1 {
    margin: 0;
    color: #ffffff;
    font-size: 2rem;
}

.admin-container .admin-nav button {
    color: #ffffff;
    background-color: transparent;
    border: 1px solid #ffffff;
    margin-left: 1rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    color: var(--text);
    opacity: 0.6;
    transition: opacity 0.2s;
}

.close-btn:hover {
    opacity: 1;
}

.user-management {
    background: var(--card-bg);
    border-radius: 4px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

/* Tables */
.picks-table {
    width: 100%;
    overflow-x: auto;
    overflow-y: auto;
    max-height: 80vh; /* Adjust as needed */
}

.picks-table table {
    width: 100%;
    border-collapse: collapse;
}

.picks-table th, .picks-table td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.picks-table th {
    background-color: #f2f2f2;
    position: sticky;
    top: 0;
    z-index: 1;
}

/* Hover effect for table rows */
.picks-table tr:hover {
    background-color: #f0f0f0;
}

/* Editing effect for table cells */
.picks-table td[contenteditable]:focus {
    background-color: #ffffff;
    outline: none;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 8px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #f2f2f2;
}

@media screen and (max-width: 600px) {
    table, thead, tbody, th, td, tr {
        display: block;
    }

    th, td {
        padding: 8px;
        text-align: left;
    }

    th {
        background-color: #f2f2f2;
    }

    tr {
        margin-bottom: 1rem;
    }

    td {
        border: none;
        position: relative;
        padding-left: 50%;
    }

    td:before {
        position: absolute;
        top: 0;
        left: 0;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
    }

    td:nth-of-type(1):before { content: "ID"; }
    td:nth-of-type(2):before { content: "First Name"; }
    td:nth-of-type(3):before { content: "Last Name"; }
    td:nth-of-type(4):before { content: "Role"; }
    td:nth-of-type(5):before { content: "Section"; }
    td:nth-of-type(6):before { content: "Image"; }
    td:nth-of-type(7):before { content: "Felon"; }
    td:nth-of-type(8):before { content: "Confirmed"; }
    td:nth-of-type(9):before { content: "Experience"; }
    td:nth-of-type(10):before { content: "Billionaire"; }
    td:nth-of-type(11):before { content: "Millionaire"; }
    td:nth-of-type(12):before { content: "Announced"; }
    td:nth-of-type(13):before { content: "Pardoned"; }
    td:nth-of-type(14):before { content: "Project 2025"; }
}

/* Forms */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
}

.form-group input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* User Management */
.user-management {
    margin-top: 20px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: none; /* Hidden by default */
}

/* Buttons */
button {
    background-color: var(--secondary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #e70404;
}

.logout-btn {
    background-color: var(--secondary);
}

.logout-btn:hover {
    background-color: #e70404;
}

/* Utilities */
.error {
    color: #dc3545;
    padding: 8px;
    margin: 8px 0;
    border-radius: 4px;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
}

.success {
    background-color: #e6ffe6;
    transition: background-color 0.5s;
}

@media (max-width: 600px) {
    .sections, .news-container {
        padding: 1rem;
    }
    
    .grid-container, .news-grid {
        grid-template-columns: 1fr;
    }

    .picks-table, .picks-table table, .picks-table thead, .picks-table tbody, .picks-table th, .picks-table td, .picks-table tr {
        display: block;
    }

    .picks-table th, .picks-table td {
        padding: 8px;
        text-align: left;
    }

    .picks-table th {
        background-color: #f2f2f2;
    }

    .picks-table tr {
        margin-bottom: 1rem;
    }

    .picks-table td {
        border: none;
        position: relative;
        padding-left: 50%;
    }

    .picks-table td:before {
        position: absolute;
        top: 0;
        left: 0;
        width: 45%;
        padding-right: 10px;
        white-space: nowrap;
    }

    .picks-table td:nth-of-type(1):before { content: "ID"; }
    .picks-table td:nth-of-type(2):before { content: "First Name"; }
    .picks-table td:nth-of-type(3):before { content: "Last Name"; }
    .picks-table td:nth-of-type(4):before { content: "Role"; }
    .picks-table td:nth-of-type(5):before { content: "Section"; }
    .picks-table td:nth-of-type(6):before { content: "Image"; }
    .picks-table td:nth-of-type(7):before { content: "Announced"; }
    .picks-table td:nth-of-type(8):before { content: "Confirmed"; }
    .picks-table td:nth-of-type(9):before { content: "Experience"; }
    .picks-table td:nth-of-type(10):before { content: "Billionaire"; }
    .picks-table td:nth-of-type(11):before { content: "Millionaire"; }
    .picks-table td:nth-of-type(12):before { content: "Pardoned"; }
    .picks-table td:nth-of-type(13):before { content: "Project 2025"; }
}

/* Update default visibility states */
#loginForm {
    display: none; /* Hidden initially until auth check */
}

#adminPanel {
    display: none; /* Hidden initially until auth check */
}

#userManagement {
    display: none; /* Hidden by default */
}

.modal {
    display: flex;
    justify-content: center;
    align-items: center;
    position: fixed;
    z-index: 1;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fefefe;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
    cursor: pointer;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.tag {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

.tag.felon { background: #ff4444; color: white; }
.tag.experienced { background: #2196F3; color: white; }
.tag.billionaire { background: #FFD700; color: black; }
.tag.millionaire { background: #FFA500; color: black; }
.tag.announced { background: #ff8f44; color: black; }
.tag.confirmed { background: #28a745; color: white; }
.tag.named { background: #28a745; color: white; }
.tag.elected { background: #17a2b8; color: white; }
.tag.withdrawn { background: #42424236; color: black; }
.tag.pardoned { background-color: #9c27b0; color: white; }
.tag.project2025 { background-color: #ff5722; color: white; }

.card {
    padding: 1rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.card img {
    display: block;
    width: 150px;
    height: 200px;
    object-fit: cover;
    object-position: center top;
    border-radius: 4px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.pick-status {
    width: 100%;
    padding: 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: white;
}

.pick-status:focus {
    outline: none;
    border-color: #007bff;
}

.pick-status option {
    padding: 4px;
}

/* Status-specific colors */
.pick-status option[value="announced"] { color: black; }
.pick-status option[value="confirmed"] { color: black; }
.pick-status option[value="named"] { color: black; }
.pick-status option[value="elected"] { color: black; }
.pick-status option[value="withdrawn"] { color: black; }

#picksTable th {
    position: sticky;
    top: 0;
    background-color: #f8f9fa;
    z-index: 10;
    padding: 12px;
    border-bottom: 2px solid #dee2e6;
    text-align: left;
}

#picksTable th:hover {
    background-color: #e9ecef;
}

.table-container {
    max-height: 80vh;
    overflow-y: auto;
}

#ovalOffice {
    margin-bottom: 20px;
    padding-bottom: 20px;
}

#ovalOffice h2 {
    color: #1a1a1a;
    margin-bottom: 15px;
}

#backToTop {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: var(--secondary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    display: none; /* Hidden by default */
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 1000;
}

#backToTop:hover {
    opacity: 0.8;
    transform: scale(1.1);
}