/* Reset และ Base Styles */
@import url('https://slw-system.pages.dev/assets/css/font-face.css');

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

body {
    font-family: CPN, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

header {
    background-color: #2c3e50;
    color: white;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    font-size: 1.5rem;
}

nav a, nav button {
    color: white;
    text-decoration: none;
    margin-left: 1rem;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
}

nav a:hover, nav button:hover {
    text-decoration: underline;
}

main {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

h2 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

/* Login Page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
}

.login-box {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    text-align: center;
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

button[type="submit"] {
    width: 100%;
    padding: 0.75rem;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    margin-top: 1rem;
}

button[type="submit"]:hover {
    background-color: #2980b9;
}

.divider {
    text-align: center;
    margin: 1.5rem 0;
    position: relative;
}

.divider::before, .divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 45%;
    height: 1px;
    background-color: #ddd;
}

.divider::before {
    left: 0;
}

.divider::after {
    right: 0;
}

.discord-btn {
    width: 100%;
    padding: 0.75rem;
    background-color: #5865F2;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.discord-btn:hover {
    background-color: #4752c4;
}

.discord-btn img {
    width: 20px;
    height: 20px;
}

.error-message {
    color: #e74c3c;
    margin-top: 1rem;
    text-align: center;
}

/* Dashboard */
#welcomeMessage {
    margin-bottom: 2rem;
}

.candidates {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.candidate-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

.candidate-card:hover {
    transform: translateY(-5px);
}

.candidate-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.candidate-card h4 {
    padding: 1rem 1rem 0.5rem;
    color: #2c3e50;
}

.candidate-card p {
    padding: 0 1rem 1rem;
    color: #7f8c8d;
    font-size: 0.9rem;
}

.vote-btn {
    display: block;
    width: calc(100% - 2rem);
    margin: 0 1rem 1rem;
    padding: 0.5rem;
    background-color: #2ecc71;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.vote-btn:hover {
    background-color: #27ae60;
}

/* Results */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5rem;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

th {
    background-color: #2c3e50;
    color: white;
}

tr:hover {
    background-color: #f5f5f5;
}

tr.total {
    font-weight: bold;
    background-color: #f8f9fa;
}

/* Admin */
.settings-section, .candidates-section {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

#notAdmin {
    text-align: center;
    padding: 2rem;
    color: #e74c3c;
    display: none;
}
