* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #475569;
    --primary-dark: #334155;
    --primary-light: #64748b;
    --secondary-color: #64748b;
    --secondary-dark: #475569;
    --accent-color: #94a3b8;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    --bg-gradient: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
    --bg-gradient-alt: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-light: #64748b;
    --bg-white: #ffffff;
    --bg-gray-50: #f8fafc;
    --bg-gray-100: #f1f5f9;
    --bg-gray-200: #e2e8f0;
    --bg-gray-300: #cbd5e1;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
}

body {
    font-family: 'Segoe UI', 'Heebo', 'Assistant', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-gradient-alt);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
    direction: rtl;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(71, 85, 105, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(100, 116, 139, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-2xl);
    padding: 40px;
    position: relative;
    z-index: 1;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

header {
    text-align: center;
    margin-bottom: 35px;
    padding-bottom: 25px;
    border-bottom: 2px solid var(--bg-gray-200);
    position: relative;
}

header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
}

header h1 {
    color: var(--primary-color);
    font-size: 2.8em;
    margin-bottom: 12px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.2em;
    font-weight: 400;
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 20px;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-gray-200);
    color: var(--text-primary);
    border: 1px solid var(--bg-gray-200);
}

.btn-secondary:hover {
    background: var(--bg-gray-100);
    border-color: var(--bg-gray-100);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 68, 68, 0.5);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.5);
}

.icon {
    font-size: 20px;
    font-weight: bold;
}

.search-box {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-box input {
    width: 100%;
    padding: 14px 45px 14px 18px;
    border: 2px solid var(--bg-gray-200);
    border-radius: var(--radius-lg);
    font-size: 16px;
    transition: all 0.3s ease;
    background: var(--bg-gray-50);
    font-family: inherit;
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.search-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 1.2em;
    pointer-events: none;
}

.loading {
    text-align: center;
    padding: 40px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #f5c6cb;
}

.members-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.member-card {
    background: var(--bg-white);
    border: 2px solid var(--bg-gray-200);
    border-radius: var(--radius-xl);
    padding: 25px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: var(--shadow-sm);
}

.member-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 0;
    background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
    border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
    transition: height 0.3s ease;
}

.member-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.member-card:hover::before {
    height: 100%;
}

.member-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.member-name {
    font-size: 1.4em;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.member-actions {
    display: flex;
    gap: 8px;
}

.btn-icon {
    padding: 6px 12px;
    font-size: 14px;
    border-radius: 6px;
}

/* Edit button - neutral blue-gray */
.btn-success.btn-icon {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
    border: none;
}

.btn-success.btn-icon:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Delete button - softer red */
.btn-danger.btn-icon {
    background: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 100%);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--bg-gray-300);
}

.btn-danger.btn-icon:hover {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.member-details {
    color: var(--text-secondary);
    line-height: 1.8;
    font-size: 0.95em;
}

.member-details strong {
    color: var(--text-primary);
    font-weight: 600;
}

.member-details div {
    margin-bottom: 8px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--bg-white);
    border-radius: var(--radius-2xl);
    padding: 0;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-2xl);
    animation: slideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.modal-small {
    max-width: 400px;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 35px;
    border-bottom: 2px solid var(--bg-gray-200);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
}

.modal-header h2 {
    color: var(--primary-color);
    font-size: 1.6em;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-body {
    padding: 20px 30px;
}

#memberForm,
#announcement-form {
    padding: 30px 35px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--bg-gray-200);
    border-radius: var(--radius-lg);
    font-size: 16px;
    transition: all 0.3s ease;
    font-family: inherit;
    background: var(--bg-gray-50);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px rgba(71, 85, 105, 0.1);
}

.form-group textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

.help-text {
    display: block;
    margin-top: 5px;
    color: #999;
    font-size: 0.9em;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #f0f0f0;
}

.warning {
    color: #dc3545;
    font-weight: 600;
    margin-top: 10px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.empty-state h3 {
    color: #666;
    margin-bottom: 10px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #f0f0f0;
}

.tab-btn {
    padding: 14px 28px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    font-family: inherit;
}

.tab-btn::before {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.3s ease;
}

.tab-btn:hover {
    color: var(--primary-color);
}

.tab-btn.active {
    color: var(--primary-color);
}

.tab-btn.active::before {
    width: 100%;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Announcements */
.announcements-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.announcement-card {
    background: var(--bg-white);
    border: 2px solid var(--bg-gray-200);
    border-radius: var(--radius-xl);
    padding: 25px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    position: relative;
}

.announcement-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 0;
    background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
    border-radius: 0 var(--radius-xl) var(--radius-xl) 0;
    transition: height 0.3s ease;
}

.announcement-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.announcement-card:hover::before {
    height: 100%;
}

.announcement-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.announcement-card-header h3 {
    color: #667eea;
    font-size: 1.2em;
}

.announcement-card-body {
    color: #666;
    line-height: 1.8;
}

.announcement-title-display {
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.announcement-message-display {
    color: #666;
    white-space: pre-wrap;
}

/* Prayer Times Form */
.prayer-times-form {
    max-width: 600px;
    margin: 0 auto;
}

.prayer-times-form .form-group textarea {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--bg-gray-200);
    border-radius: var(--radius-lg);
    font-size: 16px;
    transition: all 0.3s ease;
    font-family: inherit;
    background: var(--bg-gray-50);
    resize: vertical;
}

.prayer-times-form .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px rgba(71, 85, 105, 0.1);
}

/* Switch Buttons */
.switch-buttons {
    display: flex;
    background: var(--bg-gray-100);
    border-radius: var(--radius-lg);
    padding: 5px;
    gap: 5px;
    margin-bottom: 12px;
    position: relative;
}

.switch-btn {
    flex: 1;
    padding: 12px 18px;
    text-align: center;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    user-select: none;
    border: none;
    display: block;
    font-family: inherit;
    font-size: 0.95em;
}

.switch-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-color);
}

.switch-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 20px;
    }

    header h1 {
        font-size: 2em;
    }

    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        max-width: 100%;
    }

    .members-list {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .switch-btn {
        padding: 8px 12px;
        font-size: 14px;
    }
    
    /* Page order buttons - make more prominent on mobile */
    .page-order-item {
        flex-direction: column;
        align-items: stretch;
    }
    
    .page-order-item > div:first-child {
        margin-bottom: 8px;
    }
    
    .page-order-buttons {
        justify-content: center;
        width: 100%;
    }
    
    .page-order-btn {
        flex: 1;
        padding: 10px !important;
        font-size: 16px !important;
        min-width: 60px;
    }
    
    .drag-handle {
        display: none;
    }
}

/* Footer */
.footer {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 40px;
}

.logout-btn {
    padding: 10px 24px;
    background: var(--bg-white);
    color: var(--text-primary);
    border: 1px solid var(--bg-gray-300);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    font-family: inherit;
}

.logout-btn:hover {
    background: var(--bg-gray-50);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

