/* Mission Trip Platform - Global Styles */
/* Modern, Professional Design */

:root {
    /* Primary Colors - Vibrant but not harsh */
    --primary: #4F46E5;
    --primary-dark: #4338CA;
    --primary-light: #818CF8;

    /* Secondary Colors - Complementary */
    --secondary: #06B6D4;
    --secondary-dark: #0891B2;
    --secondary-light: #22D3EE;

    /* Semantic Colors */
    --success: #10B981;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --danger: #EF4444;
    --danger-light: #FEE2E2;

    /* Neutral Colors */
    --gray-50: #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;

    /* Light Mode - Backgrounds */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F9FAFB;
    --bg-tertiary: #F3F4F6;

    /* Light Mode - Borders */
    --border-light: #E5E7EB;
    --border-dark: #D1D5DB;

    /* Light Mode - Text */
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-tertiary: #9CA3AF;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* Dark Mode */
html[data-theme="dark"] {
    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --bg-tertiary: #334155;

    --border-light: #334155;
    --border-dark: #475569;

    --text-primary: #F1F5F9;
    --text-secondary: #CBD5E1;
    --text-tertiary: #94A3B8;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.5);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Common Classes */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.btn {
    background: var(--primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    font-size: 0.95rem;
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
}

.btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3);
}

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
}

.btn-primary {
    background: var(--primary);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    background: var(--primary-dark);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3);
}

.btn-success {
    background: var(--success);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.2);
}

.btn-success:hover {
    background: #059669;
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background: var(--danger);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: #DC2626;
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.3);
}

.btn-secondary {
    background: var(--gray-500);
    box-shadow: 0 2px 8px rgba(107, 114, 128, 0.2);
}

.btn-secondary:hover {
    background: var(--gray-600);
    box-shadow: 0 6px 16px rgba(107, 114, 128, 0.3);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Loading State on Button */

.btn.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

/* Keyboard Focus Accessibility */

button:focus,
input:focus,
select:focus,
textarea:focus,
a:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
    outline: none;
}

/* Minimum touch target size (mobile accessibility) */

button,
.btn,
input[type="checkbox"],
input[type="radio"] {
    min-height: 44px;
    min-width: 44px;
}

.btn {
    min-height: 44px;
    padding: 0.75rem 1.5rem;
}

/* Calendar Button */

.calendar-btn {
    background: var(--secondary);
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    font-size: 0.85rem;
    box-shadow: 0 2px 6px rgba(6, 182, 212, 0.2);
}

.calendar-btn:hover {
    background: var(--secondary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.3);
}

.calendar-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(6, 182, 212, 0.2);
}

html[data-theme="dark"] .calendar-btn {
    background: var(--secondary-dark);
}

html[data-theme="dark"] .calendar-btn:hover {
    background: var(--secondary-light);
    color: #0F172A;
}

/* Theme Toggle Button */

#themeToggleBtn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    color: inherit;
}

#themeToggleBtn:hover {
    transform: scale(1.1);
    opacity: 0.8;
}

#themeToggleBtn:active {
    transform: scale(0.95);
}

/* Theme button on light backgrounds (index.html) */
header #themeToggleBtn {
    color: white;
}

header #themeToggleBtn:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Messages */

.error-message {
    background: var(--danger-light);
    color: #991b1b;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid var(--danger);
}

.error-message.show {
    display: block;
}

.success-message {
    background: var(--success-light);
    color: #065f46;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid var(--success);
}

.success-message.show {
    display: block;
}

.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-success {
    background: var(--success-light);
    border: 2px solid var(--success);
    color: #065f46;
}

.alert-error {
    background: var(--danger-light);
    border: 2px solid var(--danger);
    color: #991b1b;
}

.alert-warning {
    background: var(--warning-light);
    border: 2px solid var(--warning);
    color: #92400e;
}

/* Forms */

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--bg-primary);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
    background: var(--bg-primary);
}

/* Form Validation Feedback */

.form-error-message {
    color: var(--danger);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: none;
}

.form-error-message.show {
    display: block;
}

.form-group.error input,
.form-group.error select,
.form-group.error textarea {
    border-color: var(--danger);
    background: rgba(239, 68, 68, 0.05);
}

.form-group.error input:focus,
.form-group.error select:focus,
.form-group.error textarea:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-success-message {
    color: var(--success);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: none;
}

.form-success-message.show {
    display: block;
}

/* Enhanced Input Styling */

.form-group input::placeholder,
.form-group textarea::placeholder,
.form-group select::placeholder {
    color: var(--text-tertiary);
    opacity: 0.7;
}

.form-group input:disabled,
.form-group select:disabled,
.form-group textarea:disabled {
    background-color: var(--bg-tertiary);
    color: var(--text-tertiary);
    cursor: not-allowed;
    opacity: 0.6;
}

.form-group input:disabled::placeholder,
.form-group textarea:disabled::placeholder {
    color: var(--text-tertiary);
    opacity: 0.5;
}

/* Tables */

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-primary);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.data-table th {
    background: var(--bg-tertiary);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-light);
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.data-table tr:hover {
    background: var(--bg-secondary);
}

/* Cards */

.card {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    border-color: var(--primary-light);
}

.card-header {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--border-light);
    padding-bottom: 0.75rem;
}

.card-body {
    color: var(--text-secondary);
}

/* Loading States */

.loading {
    text-align: center;
    padding: 2rem;
    color: #999;
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Status Badges */

.badge {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-success {
    background: var(--success-light);
    color: #065f46;
}

.badge-warning {
    background: var(--warning-light);
    color: #92400e;
}

.badge-danger {
    background: var(--danger-light);
    color: #991b1b;
}

.badge-info {
    background: rgba(79, 70, 229, 0.1);
    color: #4338ca;
}

.badge-light {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

/* Modal */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-light);
    animation: slideUp 0.3s ease;
}

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

.modal-header {
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-light);
    padding-bottom: 1rem;
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.25rem;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    border-top: 2px solid var(--border-light);
    padding-top: 1rem;
}

/* Modal Close Button */

.modal-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    color: var(--text-tertiary);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.modal-close:hover {
    color: var(--text-primary);
    transform: scale(1.15);
}

.modal-close:active {
    transform: scale(0.95);
}

/* Empty State */

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.3;
    display: block;
}

.empty-state h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.empty-state .btn {
    margin-top: 1rem;
}

/* Toast Notifications */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    max-width: 400px;
}

.toast {
    background: white;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    margin-bottom: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.3s ease;
    display: flex;
    gap: 1rem;
    align-items: center;
}

@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-left: 4px solid var(--success);
    color: #065f46;
}

.toast.error {
    border-left: 4px solid var(--danger);
    color: #991b1b;
}

.toast.warning {
    border-left: 4px solid var(--warning);
    color: #92400e;
}

.toast.info {
    border-left: 4px solid var(--primary);
    color: #1f2937;
}

.toast-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-close {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    color: #999;
    padding: 0;
    flex-shrink: 0;
}

.toast-close:hover {
    color: #333;
}

/* Headers & Typography */

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.5rem;
}

h1 {
    font-size: 2rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.25rem;
}

p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--primary-dark);
}

/* Portal Headers */

.portal-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 2rem;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
}

.portal-header h1 {
    color: white;
    margin-bottom: 0.5rem;
}

.portal-header p {
    color: rgba(255, 255, 255, 0.9);
}

/* Utility Classes */

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: #999;
    font-size: 0.9rem;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

/* Responsive */

@media (max-width: 768px) {
    .container {
        padding: 0 0.5rem;
    }

    .modal-content {
        width: 95%;
        padding: 1.5rem;
    }

    .data-table {
        font-size: 0.9rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.75rem;
    }

    .card {
        padding: 1rem;
    }
}

/* Specific Component Styles */

.section-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 0.75rem;
}

.action-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.search-box {
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    width: 100%;
    max-width: 300px;
    font-family: inherit;
}

.search-box:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

/* Status-specific colors */

.status-pending {
    color: #ff9800;
}

.status-approved {
    color: #4caf50;
}

.status-rejected {
    color: #f44336;
}

.status-paid {
    color: #4caf50;
}

.status-partial {
    color: #ff9800;
}

/* Payment Status */

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

.payment-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.payment-row:last-child {
    border-bottom: none;
}

.currency {
    font-weight: 600;
    color: #2e7d32;
}

/* Grid Utilities */

.grid {
    display: grid;
    gap: 1rem;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Collapsible */

.collapsible {
    cursor: pointer;
    padding: 1rem;
    background: #f5f5f5;
    border: none;
    border-radius: 6px;
    width: 100%;
    text-align: left;
    font-weight: 600;
    transition: background 0.3s;
}

.collapsible:hover {
    background: #e0e0e0;
}

.collapsible.active {
    background: #007bff;
    color: white;
}

.collapsible-content {
    display: none;
    padding: 1rem;
    background: white;
    border-radius: 0 0 6px 6px;
    border-left: 4px solid #007bff;
}

.collapsible-content.active {
    display: block;
}

/* Print Styles */

@media print {
    .btn,
    .action-bar,
    .modal {
        display: none;
    }

    .container {
        max-width: 100%;
    }
}
