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

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

.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.error-container {
    text-align: center;
    padding: 2rem;
}

.error-container i {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.error-container h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.error-container p {
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content.announcement-modal {
    background: white;
    border-radius: 15px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 1.5rem;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 2rem;
    color: #666;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s;
}

.modal-close:hover {
    background: #f0f0f0;
}

.detail-image {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 1rem;
}

.detail-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.detail-meta .date {
    color: #666;
    font-size: 0.9rem;
}

.detail-content {
    line-height: 1.6;
    color: #333;
    white-space: pre-wrap;
}

.empty-message {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-style: italic;
}

.error-message {
    text-align: center;
    padding: 2rem;
    color: #dc3545;
    background: #f8d7da;
    border-radius: 8px;
    margin: 1rem 0;
}

.screen {
    min-height: 100vh;
    background: #f5f5f5;
}

.hidden {
    display: none !important;
}

/* Registration Screen */
.registration-container {
    padding: 2rem;
    max-width: 500px;
    margin: 0 auto;
}

.registration-container .header {
    text-align: center;
    margin-bottom: 2rem;
}

.registration-container .header h1 {
    font-size: 1.8rem;
    color: #333;
    margin-bottom: 0.5rem;
}

.registration-container .header p {
    color: #666;
}

/* Main App */
.app-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid white;
}

.user-details h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.user-details .small {
    font-size: 0.8rem;
    opacity: 0.9;
}

.points-badge {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Navigation Tabs */
.nav-tabs {
    background: white;
    display: flex;
    padding: 0.5rem;
    gap: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.tab-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.75rem;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    color: #666;
    transition: all 0.3s;
}

.tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.tab-btn i {
    font-size: 1.25rem;
}

.tab-btn span {
    font-size: 0.75rem;
}

/* Tab Content */
.tab-content {
    padding: 1rem;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Quick Actions */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.action-btn {
    background: white;
    border: none;
    padding: 1.5rem;
    border-radius: 15px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.action-btn i {
    font-size: 2rem;
    color: #667eea;
}

.action-btn span {
    font-size: 0.9rem;
    color: #333;
}

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

.section h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    color: #333;
}

.section h3 i {
    color: #667eea;
}

/* Cards */
.announcement-card, .poll-card, .marketplace-card {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    border-left: 4px solid #667eea;
}

.announcement-card.urgent {
    border-left-color: #dc3545;
}

.announcement-card.event {
    border-left-color: #28a745;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.card-title {
    font-weight: 600;
    color: #333;
}

.card-meta {
    font-size: 0.8rem;
    color: #666;
}

.card-content {
    color: #555;
    margin-bottom: 0.5rem;
}

.card-image {
    width: 100%;
    border-radius: 8px;
    margin: 0.5rem 0;
}

/* Filter Bar */
.filter-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.filter-btn {
    background: white;
    border: 1px solid #ddd;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s;
}

.filter-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Services Grid */
.services-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.service-card {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
}

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

.service-card i {
    font-size: 2rem;
    color: #667eea;
    margin-bottom: 0.5rem;
}

.service-card h4 {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    color: #333;
}

.service-card p {
    font-size: 0.75rem;
    color: #666;
}

/* Profile Card */
.profile-card {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    text-align: center;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #667eea;
    margin-bottom: 1rem;
}

.profile-points {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: 20px;
    margin-top: 1rem;
}

/* Profile Menu */
.profile-menu {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.menu-item {
    width: 100%;
    border: none;
    background: white;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    transition: background 0.2s;
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item:hover {
    background: #f8f9fa;
}

.menu-item i {
    color: #667eea;
    width: 20px;
}

/* Screen Header */
.screen-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.back-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.screen-header h2 {
    flex: 1;
    font-size: 1.2rem;
}

.add-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Screen Content */
.screen-content {
    padding: 1.5rem;
}

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

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

/* SOS Button */
.sos-content {
    text-align: center;
}

.sos-warning {
    background: #fff3cd;
    border: 1px solid #ffc107;
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 2rem;
}

.sos-warning i {
    font-size: 2rem;
    color: #856404;
    margin-bottom: 0.5rem;
}

.sos-btn {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    font-size: 1.5rem;
    margin: 0 auto 2rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.location-info {
    background: #d4edda;
    border: 1px solid #28a745;
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
}

/* QR Code */
.qr-result {
    text-align: center;
    margin-top: 2rem;
}

.qr-result img {
    max-width: 200px;
    border: 2px solid #667eea;
    border-radius: 10px;
    padding: 1rem;
    background: white;
}

.qr-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.qr-container {
    text-align: center;
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.qr-container img {
    max-width: 250px;
    border: 2px solid #667eea;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.member-info h3 {
    color: #333;
    margin-bottom: 0.5rem;
}

.member-info p {
    color: #666;
    font-size: 0.9rem;
}

/* Areas List */
.areas-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.area-card {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.area-card h4 {
    color: #333;
    margin-bottom: 0.5rem;
}

.area-card p {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.area-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 10px;
    margin-bottom: 1rem;
}

/* Directory List */
.directory-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.directory-item {
    background: white;
    padding: 1rem;
    border-radius: 10px;
    display: flex;
    gap: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.directory-item img {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    object-fit: cover;
}

.directory-info h4 {
    color: #333;
    margin-bottom: 0.25rem;
}

.directory-info p {
    color: #666;
    font-size: 0.85rem;
}

.directory-info .phone {
    color: #667eea;
    font-weight: 600;
}

/* Marketplace List */
.marketplace-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.marketplace-item {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.marketplace-item img {
    width: 100%;
    height: 150px;
    object-fit: cover;
}

.marketplace-item-content {
    padding: 1rem;
}

.marketplace-item h4 {
    font-size: 0.9rem;
    color: #333;
    margin-bottom: 0.5rem;
}

.marketplace-item .price {
    color: #667eea;
    font-weight: 600;
}

.marketplace-item .category {
    font-size: 0.75rem;
    color: #666;
    background: #f8f9fa;
    padding: 0.25rem 0.5rem;
    border-radius: 10px;
    display: inline-block;
}

/* Fee Summary */
.fee-summary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 15px;
    margin-bottom: 1.5rem;
}

.fee-summary h3 {
    margin-bottom: 1rem;
}

.fee-summary .amount {
    font-size: 2rem;
    font-weight: 700;
}

.fee-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.fee-item {
    background: white;
    padding: 1rem;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.fee-item .amount {
    font-weight: 600;
    color: #333;
}

.fee-item .status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
}

.fee-item .status.pending {
    background: #fff3cd;
    color: #856404;
}

.fee-item .status.paid {
    background: #d4edda;
    color: #155724;
}

.fee-item .status.overdue {
    background: #f8d7da;
    color: #721c24;
}

/* Contacts List */
.contacts-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contact-item {
    background: white;
    padding: 1rem;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.contact-item .delete-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 5px;
    cursor: pointer;
}

.contact-form {
    background: white;
    padding: 1.5rem;
    border-radius: 15px;
    margin-top: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 1rem 2rem;
    border-radius: 10px;
    z-index: 1000;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateX(-50%) translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

/* Utility Classes */
.text-muted {
    color: #6c757d;
}

.small {
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 480px) {
    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .services-grid {
        grid-template-columns: 1fr;
    }
    
    .marketplace-list {
        grid-template-columns: 1fr;
    }
}

/* Status Badges */
.status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    display: inline-block;
}
.status.pending {
    background: #fff3cd;
    color: #856404;
}
.status.confirmed, .status.paid, .status.completed {
    background: #d4edda;
    color: #155724;
}
.status.cancelled, .status.rejected, .status.overdue {
    background: #f8d7da;
    color: #721c24;
}
.status.in_progress {
    background: #cce5ff;
    color: #004085;
}

/* Custom items for My Reports and My Bookings */
.report-item, .booking-item {
    background: white;
    padding: 1.25rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border-left: 4px solid #667eea;
}

.report-header, .booking-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.report-item p, .booking-item p {
    font-size: 0.9rem;
    color: #555;
    margin-bottom: 0.5rem;
}

.report-item .small, .booking-item .small {
    font-size: 0.8rem;
}

.booking-item .time {
    color: #667eea;
    font-weight: 500;
}

.booking-item .btn-sm {
    padding: 0.5rem;
    font-size: 0.85rem;
    width: auto;
    display: inline-block;
    margin-top: 0.5rem;
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: #888;
    font-size: 0.95rem;
}
