/* ===================================
   BASIC TABLE & FORM STYLES
   Church Management System
   =================================== */

:root {
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-500: #1d4ed8;
    --primary-600: #1e40af;
    --primary-700: #1e3a8a;
    
    --neutral-50: #f9fafb;
    --neutral-100: #f3f4f6;
    --neutral-200: #e5e7eb;
    --neutral-300: #d1d5db;
    --neutral-500: #6b7280;
    --neutral-600: #4b5563;
    --neutral-700: #374151;
    --neutral-800: #1f2937;
    --neutral-900: #111827;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Ebrima', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #0f172a;
    color: #e2e8f0;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    color: #f1f5f9;
    margin-bottom: 1rem;
}

a {
    color: #0ea5e9;
    text-decoration: none;
}

a:hover {
    color: #0284c7;
}

/* ===== NAVBAR ===== */
.navbar {
    background-color: #1e293b;
    border-bottom: 1px solid #334155;
}

.navbar-dark.bg-primary {
    background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%) !important;
    border-bottom: none;
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
}

.nav-link {
    color: #cbd5e1 !important;
    font-weight: 500;
    transition: all 0.3s ease;
    border-radius: 0.375rem;
    margin: 0.125rem 0.5rem;
    padding: 0.5rem 1rem;
}

.nav-link:hover {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
    color: #ffffff !important;
    background-color: rgba(14, 165, 233, 0.15);
    border-left: 4px solid #0ea5e9;
    font-weight: 600;
}

.dropdown-menu {
    background-color: #1e293b;
    border: 1px solid #334155;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.dropdown-item {
    color: #cbd5e1;
}

.dropdown-item:hover, .dropdown-item:focus {
    background-color: #334155;
    color: #ffffff;
}

/* ===== CARDS ===== */
.card {
    border: 1px solid #334155;
    border-radius: 0.5rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.2);
    background-color: #1e293b;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.3);
}

.card-header {
    background-color: #0f172a;
    border-bottom: 1px solid #334155;
    padding: 1rem 1.25rem;
    color: #f1f5f9;
}

.card-body {
    padding: 1rem;
}

/* ===== BUTTONS ===== */
.btn {
    font-weight: 600;
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    transition: all 0.15s ease;
    cursor: pointer;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.btn-primary {
    background-color: #0ea5e9;
    color: white;
}

.btn-primary:hover {
    background-color: #0284c7;
    color: white;
}

.btn-success {
    background-color: #10b981;
    color: white;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

.btn-outline-primary {
    background-color: transparent;
    color: #0ea5e9;
    border: 2px solid #0ea5e9;
}

.btn-outline-primary:hover {
    background-color: #f0f9ff;
    border-color: #0284c7;
    color: #0284c7;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* ===== FORMS ===== */
.form-control,
.form-select {
    border: 1px solid #334155;
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    transition: all 0.15s ease;
    background-color: #0f172a;
    color: #ffffff;
}

.form-control::placeholder,
.form-select::placeholder {
    color: #ffffff;
    opacity: 0.8;
}

.form-control:focus,
.form-select:focus {
    border-color: #1d4ed8;
    box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.25);
    outline: none;
    background-color: #1e293b;
    color: #f1f5f9;
}

.form-label {
    color: #ffffff;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.form-text {
    color: #ffffff;
    opacity: 0.8;
    font-size: 0.875rem;
}

/* ===== TABLES ===== */
.table {
    color: #e2e8f0;
    width: 100%;
    border-collapse: collapse;
    background-color: #1e293b;
    margin-bottom: 1rem;
}

.table thead th {
    background-color: #0f172a;
    color: #f1f5f9;
    font-weight: 600;
    border-bottom: 2px solid #334155;
    padding: 1rem;
    text-align: left;
    vertical-align: middle;
}

.table tbody td {
    padding: 1rem;
    border-bottom: 1px solid #334155;
    vertical-align: middle;
}

.table tbody tr:hover {
    background-color: #0f172a;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 0.5rem;
    border: 1px solid #334155;
}

.table-bordered thead th {
    border: 1px solid #334155;
}

.table-bordered tbody td {
    border: 1px solid #334155;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: #0f172a;
}

.table-hover tbody tr:hover {
    background-color: #334155;
}

/* ===== BADGES ===== */
.badge {
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    text-transform: uppercase;
}

/* ===== LIST GROUPS ===== */
.list-group-item {
    background-color: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

.list-group-item:hover, .list-group-item-action:hover, .list-group-item-action:focus {
    background-color: #334155;
    color: #ffffff;
}

.badge-primary {
    background-color: #cce5ff;
    color: #0369a1;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background-color: #fef08a;
    color: #92400e;
}

.badge-danger {
    background-color: #fee2e2;
    color: #7f1d1d;
}

.badge-info {
    background-color: #dbeafe;
    color: #0c4a6e;
}

.bg-info {
    background-color: #dbeafe !important;
}

/* ===== ALERTS ===== */
.alert {
    border: 1px solid;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.alert-success {
    background-color: #d1fae5;
    border-color: #10b981;
    color: #065f46;
}

.alert-danger {
    background-color: #fee2e2;
    border-color: #ef4444;
    color: #7f1d1d;
}

.alert-warning {
    background-color: #fef08a;
    border-color: #f59e0b;
    color: #92400e;
}

.alert-info {
    background-color: #dbeafe;
    border-color: #3b82f6;
    color: #0c4a6e;
}

/* ===== MODALS ===== */
.modal-content {
    background-color: #1e293b !important;
    color: #e2e8f0 !important;
    border: 1px solid #334155;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.modal-footer {
    border-top: 1px solid #334155;
}

.modal-header {
    background: linear-gradient(135deg, #1e3a8a, #1d4ed8) !important;
    color: white !important;
    border-bottom: 1px solid #334155;
    padding: 1rem 1.25rem;
}

.modal-header .btn-close {
    filter: brightness(0) invert(1);
}

/* ===== UTILITY CLASSES ===== */
.bg-white,
.bg-light {
    background-color: #1e293b !important;
    color: #ffffff !important;
}

.text-muted {
    color: #ffffff !important;
    opacity: 0.8;
}

.text-primary {
    color: #0ea5e9;
}

.text-success {
    color: #10b981;
}

.text-warning {
    color: #f59e0b;
}

.text-danger {
    color: #ef4444;
}

.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.shadow {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .card-body {
        padding: 0.75rem;
    }

    .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.875rem;
    }
}

@media print {
    @page {
        size: A4 landscape;
        margin: 10mm;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body {
        background-color: white !important;
        color: black !important;
        font-size: 10pt !important;
    }

    /* Shrink Page Headers */
    h1, .h1 { font-size: 14pt !important; margin-bottom: 5px !important; }
    h2, .h2 { font-size: 12pt !important; margin-bottom: 5px !important; }
    h3, .h3 { font-size: 11pt !important; margin-bottom: 5px !important; }
    
    .pt-3, .pb-2, .mb-3, .mb-4 {
        padding-top: 5px !important;
        padding-bottom: 5px !important;
        margin-bottom: 10px !important;
    }

    /* Hide non-print elements */
    .navbar,
    .sidebar,
    .btn,
    .btn-toolbar,
    .card-header,
    form,
    .alert,
    .modal,
    .d-print-none,
    .mobile-student-card,
    th:last-child,
    td:last-child {
        display: none !important;
    }
    
    .d-md-block {
        display: block !important;
    }

    /* Override main layout container */
    main {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        flex: 0 0 100% !important;
    }

    .card {
        border: none !important;
        box-shadow: none !important;
    }

    .card-body {
        padding: 0 !important;
    }

    /* Custom Print Table Styling */
    .table {
        width: 100% !important;
        max-width: 100% !important;
        border-collapse: collapse !important;
        margin-bottom: 0 !important;
        table-layout: auto !important;
    }

    .table th,
    .table td {
        border: 1px solid #94a3b8 !important;
        padding: 4px 2px !important;
        vertical-align: middle !important;
        font-size: 9pt !important;
    }

    .table tr {
        page-break-inside: avoid !important;
    }

    .table thead th {
        background-color: #1a2942 !important;
        color: white !important;
        text-align: center !important;
        font-weight: bold !important;
        border: 1px solid #0f172a !important;
        font-size: 8pt !important;
        padding: 4px 2px !important;
        white-space: nowrap !important;
    }

    .table tbody tr:nth-child(even) {
        background-color: #f8fafc !important;
    }

    .table tbody tr:nth-child(odd) {
        background-color: #ffffff !important;
    }
    
    /* Optimize images for print */
    .table img {
        width: 40px !important;
        height: 50px !important;
        object-fit: cover !important;
        border: 1px solid #cbd5e1 !important;
        border-radius: 4px !important;
    }

    /* Text Colors */
    .text-danger { color: #dc2626 !important; font-weight: bold !important; }
    .text-primary { color: #2563eb !important; font-weight: bold !important; }
}

/* Mobile Overrides */
@media (max-width: 767.98px) {
    .table-responsive {
        border: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        min-width: 600px;
    }
    
    .btn {
        margin-bottom: 5px;
    }
    
    .modal-dialog {
        margin: 0.5rem;
        width: auto !important;
        max-width: 100% !important;
    }
    
    .modal-content {
        width: 100%;
    }
    
    .form-control, .form-select {
        width: 100% !important;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Custom Mobile Student Card */
    .mobile-student-card {
        background: #ffffff;
        border-radius: 8px;
        box-shadow: 0 4px 6px rgba(0,0,0,0.05);
        margin-bottom: 20px;
        position: relative;
        overflow: hidden;
        font-family: 'Ebrima', sans-serif;
        color: #333;
    }
    
    .mobile-student-card::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 6px;
        background-color: #2563eb;
    }
    
    .mobile-student-card::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 6px;
        background-color: #dcfce7;
    }
    
    .msc-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 15px 15px 5px 20px;
    }
    
    .msc-badge {
        background: #64748b;
        color: white;
        padding: 2px 8px;
        border-radius: 6px;
        font-weight: bold;
        font-size: 0.85rem;
    }
    
    .msc-name {
        font-weight: bold;
        font-size: 1.1rem;
        margin: 0 0 2px 10px;
        color: #1e293b;
    }
    
    .msc-subname {
        font-size: 0.85rem;
        color: #64748b;
        margin-left: 10px;
        display: flex;
        align-items: center;
        gap: 5px;
    }
    
    .msc-level {
        background: #f8fafc;
        border: 1px solid #cbd5e1;
        font-size: 0.75rem;
        padding: 2px 8px;
        border-radius: 4px;
        margin-left: 10px;
        margin-top: 5px;
        display: inline-block;
        color: #334155;
    }
    
    .msc-menu-btn {
        background: #f1f5f9;
        border: none;
        width: 32px;
        height: 32px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #475569;
        cursor: pointer;
    }
    
    .msc-body {
        display: flex;
        padding: 10px 15px 15px 20px;
        gap: 15px;
    }
    
    .msc-photo {
        width: 100px;
        height: 125px;
        border-radius: 8px;
        object-fit: cover;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    
    .msc-photo-placeholder {
        width: 100px;
        height: 125px;
        border-radius: 8px;
        background: #cbd5e1;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-size: 3rem;
    }
    
    .msc-info-list {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .msc-info-item {
        display: flex;
        align-items: center;
        gap: 10px;
        font-size: 0.9rem;
        color: #475569;
    }
    
    .msc-info-item i {
        width: 16px;
        text-align: center;
        color: #94a3b8;
    }
    
    .msc-contact {
        padding: 0 15px 15px 20px;
        display: flex;
        flex-direction: column;
        gap: 5px;
    }
    
    .msc-footer {
        border-top: 1px dashed #cbd5e1;
        padding: 15px 20px;
        display: flex;
        gap: 10px;
    }
    
    .msc-btn {
        flex: 1;
        background: white;
        border: 1px solid #cbd5e1;
        border-radius: 6px;
        padding: 8px;
        font-weight: 500;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        text-decoration: none;
        color: #475569;
    }
    
    .msc-btn-edit {
        border-color: #10b981;
        color: #059669;
    }
    
    .msc-btn-delete {
        border-color: #cbd5e1;
        color: #475569;
    }
}
