* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Sarabun', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

/* Navbar */
.navbar {
    background: white;
    padding: 15px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    border-radius: 10px;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-container h1 {
    color: #667eea;
    font-size: 24px;
}

.nav-menu {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Container */
.container {
    max-width: 100%;
    margin: 0 auto;
}

/* Login & Register */
.login-container, .register-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 40px);
}

.login-box, .register-box, .edit-box {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 500px;
}

.register-box, .edit-box {
    max-width: 800px;
}

.login-box h2, .register-box h2, .edit-box h2 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
}

/* Form */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

button[type="submit"] {
    width: 100%;
    margin-top: 10px;
}

/* Alerts */
.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Text */
.text-center {
    text-align: center;
    margin-top: 20px;
}

.text-center a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
}

.text-center a:hover {
    text-decoration: underline;
}

/* Dashboard */
.dashboard {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.profile-section, .message-section {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.profile-section h2, .message-section h2 {
    color: #333;
    margin-bottom: 20px;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 500;
    margin-bottom: 20px;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-approved {
    background: #d4edda;
    color: #155724;
}

.status-expired {
    background: #f8d7da;
    color: #721c24;
}

/* Date Info */
.date-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.date-info p {
    margin: 5px 0;
    color: #555;
}

/* Profile Info */
.profile-info {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 30px;
}

.photo-section {
    text-align: center;
}

.photo-section img {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 5px solid #667eea;
    margin-bottom: 15px;
}

.info-table {
    width: 100%;
}

.info-table td {
    padding: 10px;
    border-bottom: 1px solid #eee;
}

.info-table td:first-child {
    width: 40%;
}

/* Messages */
.messages-list {
    max-height: 500px;
    overflow-y: auto;
}

.message-item {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.message-date {
    color: #6c757d;
    font-size: 12px;
}

.message-content p {
    margin: 10px 0;
    line-height: 1.6;
}

.admin-reply {
    background: #e3f2fd;
    padding: 15px;
    border-left: 4px solid #667eea;
    margin-top: 10px;
    border-radius: 5px;
}

.waiting-reply {
    color: #856404;
    font-style: italic;
}

/* Admin Dashboard */
.admin-dashboard {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.stats-section h2,
.pending-messages-section h2,
.users-section h2 {
    color: #333;
    margin-bottom: 20px;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    padding: 30px;
    border-radius: 10px;
    text-align: center;
    color: white;
}

.stat-card.pending {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-card.approved {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-card.expired {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

.stat-card.messages {
    background: linear-gradient(135deg, #30cfd0 0%, #330867 100%);
}

.stat-card h3 {
    font-size: 48px;
    margin-bottom: 10px;
}

/* Table */
.table-responsive {
    overflow-x: auto;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.users-table thead {
    background: #667eea;
    color: white;
}

.users-table th,
.users-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.users-table tbody tr:hover {
    background: #f8f9fa;
}

.table-photo {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.badge {
    padding: 5px 15px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
}

.badge-pending {
    background: #fff3cd;
    color: #856404;
}

.badge-approved {
    background: #d4edda;
    color: #155724;
}

.badge-expired {
    background: #f8d7da;
    color: #721c24;
}

/* Admin Message */
.admin-message-item {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.student-id {
    color: #6c757d;
    font-size: 14px;
}

.reply-form {
    margin-top: 15px;
}

.reply-form textarea {
    width: 100%;
    margin-bottom: 10px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

/* Photo Preview */
#photoPreview img {
    max-width: 200px;
    margin-top: 15px;
    border-radius: 8px;
    border: 2px solid #ddd;
}

.current-photo img {
    max-width: 300px;
    border-radius: 8px;
    margin: 15px 0;
}

/* User Detail */
.user-detail {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.detail-grid {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 40px;
    margin-bottom: 30px;
}

.detail-photo img {
    width: 250px;
    height: 250px;
    border-radius: 15px;
    object-fit: cover;
    border: 5px solid #667eea;
}

.user-messages {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #eee;
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard {
        grid-template-columns: 1fr;
    }

    .profile-info {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .nav-container {
        flex-direction: column;
        gap: 15px;
    }

    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* Admin Management */
.admin-management {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
}

.add-admin-form {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.text-muted {
    color: #6c757d;
    font-style: italic;
}

/* Scrollbar */
.messages-list::-webkit-scrollbar {
    width: 8px;
}

.messages-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.messages-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.messages-list::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}
