/* 
 * Comprehensive Mobile Responsive CSS Framework
 * Salem Dominion Ministries - Perfect Mobile Views
 * Version: 1.0
 */

/* ===== MOBILE-FIRST RESPONSIVE DESIGN ===== */

/* Base Mobile Styles (320px and up) */
@media (max-width: 320px) {
    /* Ultra Small Mobile */
    .container {
        padding: 0 8px;
    }
    
    h1 { font-size: 1.4rem !important; }
    h2 { font-size: 1.2rem !important; }
    h3 { font-size: 1.1rem !important; }
    h4 { font-size: 1rem !important; }
    h5 { font-size: 0.9rem !important; }
    h6 { font-size: 0.8rem !important; }
    
    .btn {
        font-size: 0.75rem !important;
        padding: 8px 12px !important;
        min-height: 40px;
        min-width: 40px;
    }
    
    .btn-lg {
        font-size: 0.8rem !important;
        padding: 10px 16px !important;
    }
    
    .btn-sm {
        font-size: 0.7rem !important;
        padding: 6px 10px !important;
    }
    
    .card {
        margin: 5px 0;
        border-radius: 10px;
    }
    
    .card-body {
        padding: 1rem !important;
    }
    
    .navbar-brand {
        font-size: 0.8rem !important;
    }
    
    .navbar-brand img {
        height: 25px !important;
    }
    
    .nav-link {
        font-size: 0.8rem !important;
        padding: 0.3rem 0.5rem !important;
    }
    
    .form-control {
        font-size: 0.8rem !important;
        padding: 8px 12px !important;
        min-height: 40px;
    }
    
    .form-label {
        font-size: 0.8rem !important;
    }
    
    .alert {
        font-size: 0.75rem !important;
        padding: 0.75rem 1rem !important;
    }
    
    .footer {
        padding: 2rem 0 1rem !important;
    }
    
    .footer-widget {
        margin-bottom: 1.5rem;
    }
    
    .footer-widget h4 {
        font-size: 1rem !important;
    }
    
    .footer-widget p,
    .footer-widget li {
        font-size: 0.75rem !important;
    }
}

/* Small Mobile (321px - 480px) */
@media (min-width: 321px) and (max-width: 480px) {
    .container {
        padding: 0 12px;
    }
    
    h1 { font-size: 1.5rem !important; }
    h2 { font-size: 1.3rem !important; }
    h3 { font-size: 1.2rem !important; }
    h4 { font-size: 1.1rem !important; }
    h5 { font-size: 1rem !important; }
    h6 { font-size: 0.9rem !important; }
    
    .btn {
        font-size: 0.8rem !important;
        padding: 10px 16px !important;
        min-height: 44px;
        min-width: 44px;
    }
    
    .btn-lg {
        font-size: 0.9rem !important;
        padding: 12px 20px !important;
    }
    
    .btn-sm {
        font-size: 0.75rem !important;
        padding: 8px 12px !important;
    }
    
    .card {
        margin: 8px 0;
        border-radius: 12px;
    }
    
    .card-body {
        padding: 1.2rem !important;
    }
    
    .navbar-brand {
        font-size: 0.9rem !important;
    }
    
    .navbar-brand img {
        height: 30px !important;
    }
    
    .nav-link {
        font-size: 0.85rem !important;
        padding: 0.4rem 0.6rem !important;
    }
    
    .form-control {
        font-size: 0.85rem !important;
        padding: 10px 14px !important;
        min-height: 44px;
    }
    
    .form-label {
        font-size: 0.85rem !important;
    }
    
    .alert {
        font-size: 0.8rem !important;
        padding: 0.8rem 1.2rem !important;
    }
    
    .footer {
        padding: 2.5rem 0 1.5rem !important;
    }
    
    .footer-widget h4 {
        font-size: 1.1rem !important;
    }
    
    .footer-widget p,
    .footer-widget li {
        font-size: 0.8rem !important;
    }
}

/* Medium Mobile (481px - 768px) */
@media (min-width: 481px) and (max-width: 768px) {
    .container {
        padding: 0 15px;
    }
    
    h1 { font-size: 1.8rem !important; }
    h2 { font-size: 1.5rem !important; }
    h3 { font-size: 1.3rem !important; }
    h4 { font-size: 1.2rem !important; }
    h5 { font-size: 1.1rem !important; }
    h6 { font-size: 1rem !important; }
    
    .btn {
        font-size: 0.9rem !important;
        padding: 12px 20px !important;
        min-height: 44px;
        min-width: 44px;
    }
    
    .btn-lg {
        font-size: 1rem !important;
        padding: 14px 24px !important;
    }
    
    .btn-sm {
        font-size: 0.8rem !important;
        padding: 10px 16px !important;
    }
    
    .card {
        margin: 10px 0;
        border-radius: 15px;
    }
    
    .card-body {
        padding: 1.5rem !important;
    }
    
    .navbar-brand {
        font-size: 1rem !important;
    }
    
    .navbar-brand img {
        height: 35px !important;
    }
    
    .nav-link {
        font-size: 0.9rem !important;
        padding: 0.5rem 0.8rem !important;
    }
    
    .form-control {
        font-size: 0.9rem !important;
        padding: 12px 16px !important;
        min-height: 44px;
    }
    
    .form-label {
        font-size: 0.9rem !important;
    }
    
    .alert {
        font-size: 0.85rem !important;
        padding: 1rem 1.5rem !important;
    }
    
    .footer {
        padding: 3rem 0 2rem !important;
    }
    
    .footer-widget h4 {
        font-size: 1.2rem !important;
    }
    
    .footer-widget p,
    .footer-widget li {
        font-size: 0.85rem !important;
    }
}

/* Tablet (769px - 992px) */
@media (min-width: 769px) and (max-width: 992px) {
    .container {
        padding: 0 20px;
    }
    
    h1 { font-size: 2.2rem !important; }
    h2 { font-size: 1.8rem !important; }
    h3 { font-size: 1.5rem !important; }
    h4 { font-size: 1.3rem !important; }
    h5 { font-size: 1.2rem !important; }
    h6 { font-size: 1.1rem !important; }
    
    .btn {
        font-size: 0.95rem !important;
        padding: 12px 22px !important;
    }
    
    .btn-lg {
        font-size: 1.1rem !important;
        padding: 16px 28px !important;
    }
    
    .btn-sm {
        font-size: 0.85rem !important;
        padding: 10px 18px !important;
    }
    
    .card {
        margin: 12px 0;
        border-radius: 18px;
    }
    
    .card-body {
        padding: 1.8rem !important;
    }
    
    .navbar-brand {
        font-size: 1.1rem !important;
    }
    
    .navbar-brand img {
        height: 40px !important;
    }
    
    .nav-link {
        font-size: 0.95rem !important;
        padding: 0.6rem 1rem !important;
    }
    
    .form-control {
        font-size: 0.95rem !important;
        padding: 12px 18px !important;
    }
    
    .form-label {
        font-size: 0.95rem !important;
    }
    
    .alert {
        font-size: 0.9rem !important;
        padding: 1rem 1.8rem !important;
    }
    
    .footer {
        padding: 3.5rem 0 2.5rem !important;
    }
    
    .footer-widget h4 {
        font-size: 1.3rem !important;
    }
    
    .footer-widget p,
    .footer-widget li {
        font-size: 0.9rem !important;
    }
}

/* ===== SPECIAL MOBILE COMPONENTS ===== */

/* Mobile Navigation */
@media (max-width: 768px) {
    .navbar {
        padding: 0.5rem 0;
    }
    
    .navbar-toggler {
        border: none;
        padding: 4px 8px;
    }
    
    .navbar-toggler-icon {
        width: 24px;
        height: 24px;
    }
    
    .navbar-collapse {
        background: rgba(0,0,0,0.95);
        border-radius: 10px;
        padding: 1rem;
        margin-top: 0.5rem;
        box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    }
    
    .navbar-nav {
        text-align: center;
    }
    
    .navbar-nav .nav-item {
        margin: 0.25rem 0;
    }
    
    .navbar-nav .nav-link {
        border-radius: 8px;
        transition: all 0.3s ease;
    }
    
    .navbar-nav .nav-link:hover {
        background: rgba(255,255,255,0.1);
    }
    
    .dropdown-menu {
        background: rgba(0,0,0,0.9);
        border: 1px solid rgba(255,255,255,0.1);
        border-radius: 8px;
        margin: 0.5rem 0;
    }
    
    .dropdown-item {
        color: white !important;
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
    }
    
    .dropdown-item:hover {
        background: rgba(255,255,255,0.1);
    }
}

/* Mobile Cards */
@media (max-width: 768px) {
    .card {
        border: none;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        transition: all 0.3s ease;
    }
    
    .card:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 20px rgba(0,0,0,0.15);
    }
    
    .card-img-top {
        height: 200px;
        object-fit: cover;
        border-radius: 12px 12px 0 0;
    }
    
    .card-title {
        font-size: 1.1rem !important;
        margin-bottom: 0.75rem;
    }
    
    .card-text {
        font-size: 0.9rem !important;
        line-height: 1.5;
    }
}

/* Mobile Forms */
@media (max-width: 768px) {
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-control {
        border-radius: 8px;
        border: 2px solid #e5e7eb;
        transition: all 0.3s ease;
    }
    
    .form-control:focus {
        border-color: #667eea;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    }
    
    .form-select {
        border-radius: 8px;
        border: 2px solid #e5e7eb;
        min-height: 44px;
    }
    
    .form-check {
        margin-bottom: 0.75rem;
    }
    
    .form-check-input {
        width: 20px;
        height: 20px;
        margin-top: 0.25rem;
    }
    
    .form-check-label {
        font-size: 0.9rem;
        margin-left: 0.5rem;
    }
}

/* Mobile Tables */
@media (max-width: 768px) {
    .table {
        font-size: 0.85rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
        vertical-align: middle;
    }
    
    .table-responsive {
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    /* Stack table on mobile */
    .table-mobile-stack {
        border: none;
    }
    
    .table-mobile-stack thead {
        display: none;
    }
    
    .table-mobile-stack tbody,
    .table-mobile-stack tr,
    .table-mobile-stack td {
        display: block;
        width: 100% !important;
    }
    
    .table-mobile-stack tr {
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        margin-bottom: 1rem;
        padding: 1rem;
        background: white;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .table-mobile-stack td {
        border: none;
        padding: 0.5rem 0;
        text-align: left !important;
    }
    
    .table-mobile-stack td:before {
        content: attr(data-label) ": ";
        font-weight: 600;
        color: #667eea;
        display: inline-block;
        margin-right: 0.5rem;
    }
}

/* Mobile Alerts */
@media (max-width: 768px) {
    .alert {
        border-radius: 8px;
        border: none;
        margin-bottom: 1rem;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .alert-dismissible {
        padding-right: 3rem;
    }
    
    .alert-dismissible .btn-close {
        padding: 0.75rem 1rem;
    }
}

/* Mobile Modals */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-content {
        border-radius: 12px;
        border: none;
        box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    }
    
    .modal-header {
        border-bottom: 1px solid #e5e7eb;
        padding: 1rem;
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-footer {
        border-top: 1px solid #e5e7eb;
        padding: 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .modal-footer .btn {
        width: 100%;
        margin: 0;
    }
}

/* Mobile Pagination */
@media (max-width: 768px) {
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.25rem;
    }
    
    .page-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
        border-radius: 6px;
        min-width: 40px;
        text-align: center;
    }
    
    .page-item.active .page-link {
        background: #667eea;
        border-color: #667eea;
    }
}

/* Mobile Breadcrumb */
@media (max-width: 768px) {
    .breadcrumb {
        background: transparent;
        padding: 0.5rem 0;
        margin-bottom: 1rem;
        font-size: 0.85rem;
    }
    
    .breadcrumb-item {
        padding: 0.25rem 0;
    }
    
    .breadcrumb-item + .breadcrumb-item::before {
        content: ">";
        padding: 0 0.5rem;
    }
}

/* Mobile Progress */
@media (max-width: 768px) {
    .progress {
        height: 8px;
        border-radius: 4px;
    }
    
    .progress-bar {
        border-radius: 4px;
    }
}

/* Mobile Badges */
@media (max-width: 768px) {
    .badge {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
        border-radius: 4px;
    }
}

/* Mobile Tooltips */
@media (max-width: 768px) {
    .tooltip {
        font-size: 0.75rem;
    }
    
    .tooltip-inner {
        padding: 0.5rem 0.75rem;
        border-radius: 6px;
    }
}

/* ===== TOUCH-FRIENDLY INTERACTIONS ===== */

/* Touch targets */
@media (hover: none) and (pointer: coarse) {
    .btn,
    .nav-link,
    .form-control,
    .form-select,
    .dropdown-item,
    .page-link,
    .alert-dismissible .btn-close {
        min-height: 44px;
        min-width: 44px;
        touch-action: manipulation;
    }
    
    .card {
        touch-action: manipulation;
    }
    
    .table tbody tr {
        touch-action: manipulation;
    }
}

/* ===== ACCESSIBILITY IMPROVEMENTS ===== */

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
    
    .card {
        border: 2px solid currentColor;
    }
    
    .form-control {
        border: 2px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ===== LANDSCAPE MODE FIXES ===== */

/* Mobile landscape */
@media (max-width: 768px) and (orientation: landscape) {
    .navbar {
        padding: 0.25rem 0;
    }
    
    .navbar-brand img {
        height: 25px !important;
    }
    
    .hero-section {
        padding: 2rem 0 !important;
    }
    
    .modal-dialog {
        margin: 0.25rem;
        max-height: 90vh;
    }
    
    .modal-content {
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* ===== PRINT STYLES ===== */

@media print {
    .navbar,
    .btn,
    .modal,
    .pagination,
    .breadcrumb {
        display: none !important;
    }
    
    .container {
        max-width: 100% !important;
        padding: 0 !important;
    }
    
    .card {
        border: 1px solid #000 !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }
    
    .table {
        border: 1px solid #000 !important;
    }
    
    .table th,
    .table td {
        border: 1px solid #000 !important;
    }
}
