/* ===== RESET & BASE ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
    color: #1a1a1a;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

/* ===== NAVBAR ===== */
.navbar {
    background: #ff6b35;
    color: white;
    padding: 14px 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}

.navbar-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: white;
    text-decoration: none;
    letter-spacing: -0.3px;
}

.nav-right { display: flex; align-items: center; gap: 12px; }

.user-badge {
    background: rgba(255,255,255,0.2);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
}

.btn-logout {
    color: white;
    padding: 6px 14px;
    border-radius: 5px;
    font-size: 13px;
    transition: background 0.2s;
}

.btn-logout:hover { background: rgba(255,255,255,0.2); }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.4;
}

.btn-primary { background: #ff6b35; color: white; }
.btn-primary:hover { background: #e55a2b; }

.btn-outline {
    background: white;
    color: #333;
    border: 1.5px solid #ddd;
}
.btn-outline:hover { border-color: #bbb; background: #fafafa; }

.btn-success { background: #22c55e; color: white; }
.btn-success:hover { background: #16a34a; }

.btn-filter {
    background: white;
    color: #333;
    border: 1.5px solid #ddd;
    position: relative;
}
.btn-filter:hover { border-color: #ff6b35; color: #ff6b35; }

.filter-dot {
    width: 8px; height: 8px;
    background: #ff6b35;
    border-radius: 50%;
    display: inline-block;
    margin-left: 6px;
}

.btn-info { background: #0ea5e9; color: white; }
.btn-info:hover { background: #0284c7; }

.btn-secondary { background: #e5e7eb; color: #374151; }
.btn-secondary:hover { background: #d1d5db; }

.btn-danger { background: #ef4444; color: white; }
.btn-danger:hover { background: #dc2626; }

.btn-small { padding: 5px 12px; font-size: 12px; }

.btn-lg { padding: 12px 24px; font-size: 16px; width: 100%; }

/* ===== PAGE CONTAINER ===== */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ===== TOP BAR ===== */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.top-bar-left h1 {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    line-height: 1.2;
}

.member-count {
    font-size: 14px;
    color: #888;
    font-weight: 400;
}

.top-bar-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ===== ACTIVE FILTER CHIPS ===== */
.active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.chip {
    display: inline-block;
    background: #fff3e0;
    color: #e65100;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.chip-clear {
    background: #fce4ec;
    color: #c62828;
    cursor: pointer;
}
.chip-clear:hover { background: #ef9a9a; }

/* ===== VIEW BAR ===== */
.view-bar {
    display: inline-flex;
    background: white;
    border-radius: 8px;
    border: 1.5px solid #e5e7eb;
    overflow: hidden;
    margin-bottom: 20px;
}

.view-btn {
    padding: 7px 18px;
    font-size: 13px;
    font-weight: 500;
    color: #666;
    transition: all 0.2s;
}
.view-btn:hover { color: #333; }
.view-btn.active {
    background: #ff6b35;
    color: white;
}

/* ===== FILTER OVERLAY ===== */
.filter-overlay {
    display: none;              /* HIDDEN by default */
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(2px);
    justify-content: center;
    align-items: flex-start;
    padding: 60px 20px 20px;
}

.filter-panel {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    animation: slideDown 0.25s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.filter-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #eee;
}

.filter-panel-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
}

.filter-close-btn {
    width: 32px; height: 32px;
    border: none;
    background: #f5f5f5;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #666;
    transition: background 0.2s;
}
.filter-close-btn:hover { background: #e5e5e5; }

.filter-form {
    padding: 20px 24px 24px;
}

.filter-field {
    margin-bottom: 16px;
}

.filter-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

.filter-field input,
.filter-field select {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: white;
    transition: border-color 0.2s;
    color: #333;
}

.filter-field input:focus,
.filter-field select:focus {
    outline: none;
    border-color: #ff6b35;
}

.filter-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.filter-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.filter-actions .btn {
    flex: 1;
    padding: 11px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #888;
    font-size: 16px;
}

.empty-state .btn { margin-top: 16px; }

/* ===== CARD VIEW ===== */
.members-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}

.member-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 20px;
    text-align: center;
    transition: box-shadow 0.2s, transform 0.2s;
    border: 1px solid #eee;
    text-decoration: none;
    color: inherit;
}
.member-card:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.card-photo {
    width: 80px; height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid #ff6b35;
    margin-bottom: 14px;
}

.card-name {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 6px;
}

.card-badge {
    display: inline-block;
    background: #fff3e0;
    color: #e65100;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
}

.card-info {
    font-size: 13px;
    color: #666;
    margin: 3px 0;
}

/* ===== LIST VIEW ===== */
.list-view {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.list-item {
    display: flex;
    align-items: center;
    gap: 16px;
    background: white;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 14px 18px;
    transition: box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
}
.list-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.list-photo {
    width: 48px; height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ff6b35;
    flex-shrink: 0;
}

.list-details {
    flex: 1;
    min-width: 0;
}

.list-details h3 {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 12px;
    color: #888;
}

.list-badge {
    background: #fff3e0;
    color: #e65100;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 11px;
}

.list-contact {
    flex-shrink: 0;
}

.list-mobile {
    font-size: 13px;
    color: #555;
    white-space: nowrap;
}

/* ===== ALERTS ===== */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-error { background: #fef2f2; color: #dc2626; border-left: 4px solid #dc2626; }
.alert-info { background: #eff6ff; color: #2563eb; border-left: 4px solid #2563eb; }
.alert-success { background: #f0fdf4; color: #16a34a; border-left: 4px solid #16a34a; }
.alert-success a { color: #16a34a; font-weight: 600; }

/* ===== FOOTER ===== */
.footer {
    background: #1a1a1a;
    color: #999;
    text-align: center;
    padding: 20px;
    margin-top: 40px;
    font-size: 13px;
}

/* ===== LOGIN PAGE ===== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #ff6b35 0%, #f7931e 100%);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-box h1 { color: #ff6b35; margin-bottom: 10px; }
.login-box p { color: #999; margin-bottom: 30px; }

.login-form .form-group { margin-bottom: 20px; text-align: left; }
.login-form label { display: block; margin-bottom: 5px; font-weight: 600; color: #333; }
.login-form input {
    width: 100%;
    padding: 12px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}
.login-form input:focus { outline: none; border-color: #ff6b35; }

.login-footer { margin-top: 20px; color: #999; font-size: 12px; }

/* ===== FORMS (add-member) ===== */
.form-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}
.form-container h1 { color: #ff6b35; margin: 20px 0; }

.member-form {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.member-form fieldset {
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.member-form legend {
    padding: 0 10px;
    color: #ff6b35;
    font-weight: 600;
    font-size: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.form-group { display: flex; flex-direction: column; }

.form-group label {
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: #ff6b35; }

.form-group textarea { min-height: 80px; resize: vertical; }

/* ===== ADMIN PANEL ===== */
.admin-container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 20px;
}

.admin-header {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

.admin-header h1 { color: #ff6b35; margin-bottom: 10px; }

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.admin-stat {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #ff6b35;
    text-align: center;
}

.admin-stat-value { font-size: 32px; font-weight: 700; color: #ff6b35; margin: 8px 0; }
.admin-stat-label { color: #666; font-size: 14px; }

.admin-main {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.admin-controls {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.admin-search { flex: 1; min-width: 200px; }
.admin-search input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}
.admin-search input:focus { outline: none; border-color: #ff6b35; }

.admin-table { width: 100%; border-collapse: collapse; }
.admin-table thead { background: #f8f9fa; }

.admin-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #e5e7eb;
    color: #333;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.admin-table td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
}

.admin-table tbody tr:hover { background: #fafafa; }

.admin-actions { display: flex; gap: 8px; }

.admin-actions .btn { padding: 6px 12px; font-size: 12px; }

.btn-edit { background: #0ea5e9; color: white; }
.btn-edit:hover { background: #0284c7; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .top-bar { flex-direction: column; align-items: flex-start; }
    .top-bar-right { width: 100%; }

    .hide-mobile { display: none; }

    .members-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 10px;
    }

    .member-card { padding: 16px 14px; }
    .card-photo { width: 64px; height: 64px; }
    .card-name { font-size: 14px; }

    .list-item { padding: 12px; gap: 12px; }
    .list-photo { width: 40px; height: 40px; }
    .list-details h3 { font-size: 14px; }
    .list-contact { display: none; }

    .filter-overlay { padding: 20px 12px; align-items: center; }
    .filter-panel { max-height: 90vh; }
    .filter-row-2 { grid-template-columns: 1fr; }

    .form-row { grid-template-columns: 1fr; }
    .admin-stats { grid-template-columns: 1fr; }
    .admin-actions { flex-direction: column; }
    .admin-actions .btn { width: 100%; }
}

@media (max-width: 400px) {
    .page-container { padding: 12px; }
    .top-bar-left h1 { font-size: 20px; }
    .btn { padding: 8px 12px; font-size: 13px; }
    .members-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .member-card { padding: 14px 10px; }
    .card-photo { width: 56px; height: 56px; }
}
