/* ===== Reset และฟอนต์ทั่วเว็บ ===== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

a {
    text-decoration: none;
}

body,
input,
button,
select,
textarea {
    font-family: 'Prompt', sans-serif;
    font-weight: 400;
    color: #2c3e50;
    background-color: #f4f6f7;
    line-height: 1.6;
}

/* ===== Body และ Layout ===== */
body.login-page {
    background: linear-gradient(120deg, #2980b9, #6dd5fa);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

body.admin-page {
    height: 100vh;
    display: flex;
    background-color: #ecf0f1;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 250px;
    background-color: #2c3e50;
    color: white;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100vh;
}

.sidebar h3 {
    font-weight: 600;
    font-size: 1.5rem;
    margin-bottom: 2rem;
}

.sidebar a {
    color: #ecf0f1;
    margin: 0.8rem 0;
    display: block;
    padding: 0.6rem 1rem;
    border-radius: 8px;
    font-weight: 500;
    transition: background 0.2s ease;
}

.sidebar a:hover {
    background-color: #34495e;
}

/* ===== Dashboard Content ===== */
.admin-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
}

.dashboard-content {
    flex: 1;
    padding: 2rem 3rem;
    background-color: #f9fbfd;
    overflow-y: auto;
}

.dashboard-content h2 {
    margin-bottom: 1rem;
    font-weight: 600;
    color: #2c3e50;
}

/* ===== Card Grid ===== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.card {
    background-color: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
}

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

.card h4 {
    color: #2980b9;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.card p {
    color: #555;
    font-size: 0.95rem;
}

.card-grid a.card {
    color: inherit;
    display: block;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-grid a.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

/* ===== Logout Button ===== */
.logout-btn {
    margin-top: 2rem;
    background-color: #e74c3c;
    color: white;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

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

/* ===== Login Page ===== */
.login-container {
    background: white;
    padding: 2rem 3rem;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-container h2 {
    margin-bottom: 1.5rem;
    font-weight: 600;
    color: #333;
}

.login-container input[type="text"],
.login-container input[type="password"] {
    width: 100%;
    padding: 0.8rem;
    margin: 0.5rem 0;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1rem;
    transition: border 0.2s;
    font-family: 'Prompt', sans-serif;
}

.login-container input[type="text"]:focus,
.login-container input[type="password"]:focus {
    border-color: #2980b9;
    outline: none;
}

.login-container button[type="submit"] {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    width: 100%;
    margin-top: 1rem;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

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

.error {
    color: #e74c3c;
    margin-bottom: 1rem;
    font-weight: 600;
}

/* ===== Forms (General & Settings) ===== */
.form-box,
.settings-form {
    background-color: white;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    max-width: 600px;
    margin: auto;
}

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

.form-group label,
.settings-form label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #34495e;
}

.form-group input,
.settings-form input[type="text"],
.settings-form input[type="password"] {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.settings-form input:focus {
    border-color: #3498db;
    outline: none;
}

.settings-form .hint {
    font-weight: normal;
    font-size: 0.85rem;
    color: #888;
    margin-left: 0.5rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 1rem;
}

/* ===== Buttons ===== */
.btn-primary,
.btn-secondary,
.settings-form button {
    padding: 10px 18px;
    font-size: 16px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-block;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
    border: none;
    font-weight: 600;
    transition: background-color 0.3s ease;
}

.btn-primary {
    background-color: #2ecc71;
    color: white;
}

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

.settings-form button {
    background-color: #3498db;
}

.settings-form button:hover {
    background-color: #2980b9;
}

.btn-secondary {
    background-color: #bdc3c7;
    color: #2c3e50;
}

.btn-secondary:hover {
    background-color: #95a5a6;
}

.btn-edit,
.btn-delete,
.btn-salary {
    padding: 6px 12px;
    font-size: 14px;
    border-radius: 6px;
    margin-right: 6px;
    color: white;
}

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

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

.btn-delete {
    background-color: #e74c3c;
}

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

.btn-salary {
    background-color: #4caf50;
}

.btn-salary:hover {
    background-color: #45a049;
}

/* ===== Data Tables ===== */
.user-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.user-table th,
.user-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #eaeaea;
    font-size: 0.95rem;
}

.user-table tr:hover td {
    background-color: #f5f5f5;
}

.user-table-wrapper {
    overflow-x: auto;
}

/* ===== User Controls (Search, Add) ===== */
.user-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 1.5rem;
}

.search-form {
    flex: 1;
    display: flex;
}

.search-form input[type="text"] {
    width: 100%;
    padding: 10px 16px;
    font-size: 16px;
    border-radius: 8px;
    border: 1px solid #ccc;
    background-color: #fff;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
    transition: border-color 0.3s ease;
}

.search-form input[type="text"]:focus {
    border-color: #3498db;
    outline: none;
}

/* ===== Select Dropdown ===== */
select {
    width: 100%;
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-family: 'Prompt', sans-serif;
    font-size: 1rem;
    background-color: #fff;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg fill='gray' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3Cpath d='M0 0h24v24H0z' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px 20px;
    cursor: pointer;
    transition: border 0.3s;
}

select:focus {
    border-color: #007bff;
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.15);
}

/* ===== Alerts ===== */
.alert {
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.95rem;
}

.alert.success,
.success-message {
    background-color: #d4edda;
    color: #155724;
}

.alert.error,
.error-message {
    background-color: #f8d7da;
    color: #721c24;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .dashboard-content {
        padding: 1rem;
    }

    .settings-form {
        padding: 1.5rem 1rem;
        max-width: 100%;
        margin-top: 1rem;
    }
}