/* ======================================================= */
/* 1. Base Styles and Fonts */
/* ======================================================= */

@font-face {
    font-family: 'Angkor';
    src: url('fonts/Angkor.ttf') format('truetype');
    /* បើអ្នកមាន Font ខ្មែរផ្សេងទៀត ត្រូវបន្ថែមនៅទីនេះ */
}

@font-face {
    font-family: 'Battambang';
    src: url('fonts/Battambang.ttf') format('truetype');
}

body {
    font-family: 'Battambang', Arial, sans-serif;
    background-color: #f4f7f6;
    color: #333;
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

h1, h2, h3 {
    font-family: 'Angkor', sans-serif;
    color: #2c3e50;
    margin-top: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Form Group Base */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="tel"],
select,
textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
    font-family: 'Battambang', Arial, sans-serif;
    font-size: 1em;
}

button[type="submit"],
.btn-small,
.action-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    transition: background-color 0.3s ease;
    font-family: 'Angkor', sans-serif;
}

button[type="submit"] {
    background-color: #3498db;
    color: white;
    width: 100%;
    margin-top: 10px;
}

button[type="submit"]:hover {
    background-color: #2980b9;
}

/* ======================================================= */
/* 2. Authentication Section */
/* ======================================================= */

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: #34495e;
    padding: 20px;
}

.auth-box {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
}

.auth-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid #ecf0f1;
}

.auth-tab {
    flex: 1;
    text-align: center;
    padding: 10px;
    cursor: pointer;
    font-weight: bold;
    color: #7f8c8d;
    transition: color 0.3s, border-bottom 0.3s;
    font-family: 'Angkor', sans-serif;
}

.auth-tab.active {
    color: #3498db;
    border-bottom: 3px solid #3498db;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

/* ======================================================= */
/* 3. Main Application Header & Profile (NEW) */
/* ======================================================= */

.app-container {
    display: none; /* Hidden by default, shown by JS */
}

header {
    background-color: #fff;
    padding: 20px 0;
    border-bottom: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

header h1 {
    color: #3498db;
    margin-bottom: 5px;
}

header .subtitle {
    color: #7f8c8d;
    margin-bottom: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    justify-content: flex-end; /* ផ្លាស់ប្តូរដើម្បីដាក់នៅខាងស្តាំ */
    margin-top: -80px; /* លើក user info ឡើងលើ header */
}

.profile-display {
    display: flex;
    align-items: center;
    margin-right: 20px;
}

#userAvatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #3498db;
    cursor: pointer;
    transition: transform 0.2s;
}

#userAvatar:hover {
    transform: scale(1.05);
}

.user-username {
    font-weight: bold;
    margin-right: 10px;
    font-size: 1.1em;
    color: #2c3e50;
}

.user-email {
    font-size: 0.9em;
    color: #7f8c8d;
}

.btn-small {
    padding: 8px 15px;
    font-size: 0.9em;
}

.btn-secondary {
    background-color: #ecf0f1;
    color: #34495e;
    margin-left: 10px;
}

.btn-secondary:hover {
    background-color: #bdc3c7;
}

/* ======================================================= */
/* 4. Dashboard */
/* ======================================================= */

.dashboard {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.card {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    flex: 1;
    min-width: 200px;
    text-align: center;
}

.card h3 {
    font-size: 1em;
    color: #7f8c8d;
}

.card .number {
    font-size: 2.5em;
    font-weight: bold;
    color: #3498db;
    font-family: Arial, sans-serif;
}

/* ======================================================= */
/* 5. App Tabs */
/* ======================================================= */

.tabs {
    display: flex;
    border-bottom: 2px solid #ecf0f1;
    margin-bottom: 20px;
}

.tab {
    padding: 12px 20px;
    cursor: pointer;
    font-weight: bold;
    color: #7f8c8d;
    transition: color 0.3s;
    border-bottom: 3px solid transparent;
}

.tab.active {
    color: #2c3e50;
    border-bottom: 3px solid #3498db;
}

.tab-content {
    display: none;
    padding-top: 20px;
}

.tab-content.active {
    display: block;
}

/* ======================================================= */
/* 6. Forms and Tables */
/* ======================================================= */

.event-form, .guest-list {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.search-bar {
    margin-bottom: 15px;
}

.search-bar input {
    width: 300px;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

table th, table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

table th {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #34495e;
}

table tbody tr:hover {
    background-color: #f1f1f1;
}

.action-btn {
    padding: 5px 10px;
    margin-left: 5px;
    background-color: #2ecc71;
    color: white;
    font-size: 0.9em;
    font-weight: normal;
}

.action-btn.btn-danger {
    background-color: #e74c3c;
}

.action-btn:hover {
    opacity: 0.8;
}

/* Status Badges */
.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: bold;
    display: inline-block;
}

.status-pending {
    background-color: #f39c12;
    color: white;
}

.status-confirmed {
    background-color: #2ecc71;
    color: white;
}

.status-canceled {
    background-color: #e74c3c;
    color: white;
}

/* ======================================================= */
/* 7. Modals */
/* ======================================================= */
/* 7. Modals - ធានាថារចនាបថ Modal ប្រើ display: flex; ពេលបើក */
.modal {
    display: none; 
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4); 
    /* ចំណុចសំខាន់: ប្រើ flex ពេលបង្ហាញ */
    justify-content: center;
    align-items: center;
}

/* សម្រាប់ Modal កែ Profile ថ្មី */
#editProfileModal {
    /* នៅពេល JS កំណត់ style.display = 'flex' វានឹងបង្ហាញត្រឹមត្រូវ */
    display: none; 
}

/* កូដ Modal content ដទៃទៀត... */
.modal-content {
    background-color: #fefefe;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 500px;
    position: relative;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.modal-header h2 {
    margin: 0;
    color: #3498db;
}

.close-btn {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

.close-btn:hover,
.close-btn:focus {
    color: #333;
    text-decoration: none;
}

/* Profile Modal Specific Styles (NEW) */
#profileAvatarPreview {
    margin-top: 10px;
}

#profileAvatarUpload {
    margin-top: 10px;
    width: auto;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* ======================================================= */
/* 8. Footer */
/* ======================================================= */

footer {
    text-align: center;
    padding: 10px 0;
    color: #7f8c8d;
    font-size: 0.9em;
    border-top: 1px solid #eee;
    margin-top: 30px;
}

/* ======================================================= */
/* 9. Media Queries for Responsiveness */
/* ======================================================= */

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .dashboard {
        flex-direction: column;
    }
    
    .user-info {
        flex-direction: column;
        align-items: flex-start;
        margin-top: 10px;
    }

    .profile-display {
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .btn-small {
        margin-left: 0 !important;
        margin-top: 5px;
        width: 100%;
    }
    
    .search-bar input {
        width: 100%;
    }
    
    table th, table td {
        padding: 8px;
        font-size: 0.9em;
    }
    
    /* Hide some columns on small screens */
    table th:nth-child(4), table td:nth-child(4) { /* Location/Email column */
        display: none;
    }
}