/* CBM Ministry Bootstrap Custom Styles */

/* Root Variables - Psalm 23 Inspired Heavenly Theme with God's Love */
:root {
    /* Override Bootstrap's CSS Variables - Natural Church Theme */
    --bs-primary: #2F5233;        /* Deep Forest Green */
    --bs-primary-rgb: 47, 82, 51;
    --bs-secondary: #8B4513;      /* Saddle Brown */
    --bs-secondary-rgb: 139, 69, 19;
    --bs-success: #228B22;        /* Forest Green */
    --bs-success-rgb: 34, 139, 34;
    
    /* Natural Church Colors */
    --cbm-primary: #2F5233;       /* Deep Forest Green - "Green pastures, still waters" */
    --cbm-secondary: #8B4513;     /* Saddle Brown - "Paths of earth and grounding" */
    --cbm-accent: #228B22;        /* Forest Green - "Life and growth" */
    --cbm-success: #228B22;       /* Forest Green - "Abundant life" */
    --cbm-info: #4682B4;         /* Steel Blue - "Peaceful waters" */
    --cbm-light: #F5F5DC;        /* Beige - "Pure and peaceful" */
    --cbm-dark: #2F4F4F;         /* Dark Slate Gray - "Valley shadow" */
    --cbm-gradient-start: #87CEEB; /* Sky Blue */
    --cbm-gradient-end: #98FB98;   /* Pale Green */
    
    /* Warm Love-Inspired Colors */
    --cbm-love: #FF6B6B;          /* Coral Pink - "God's unconditional love" */
    --cbm-warmth: #FFD93D;        /* Golden Yellow - "Light of the world" */
    --cbm-compassion: #FF8E53;     /* Warm Orange - "His compassions never fail" */
    --cbm-grace: #F7DC6F;         /* Soft Gold - "By grace through faith" */
    --cbm-hope: #FFB347;          /* Peach - "Hope that does not disappoint" */
    --cbm-joy: #FFCCCB;           /* Light Pink - "Joy of the Lord" */
    --cbm-gentle: #FFF0E6;        /* Warm Cream - "Gentle and lowly in heart" */
    
    /* Solid Color Equivalents (Modern Design) */
    --cbm-love-solid: #FF6B6B;          /* Primary love color */
    --cbm-warmth-solid: #FFD93D;        /* Primary warmth color */
    --cbm-heaven-love-solid: #87CEEB;   /* Primary heaven color */
}

/* Heavenly Color Scheme */
.bg-primary, 
.navbar.bg-primary,
.card.bg-primary {
    background: var(--cbm-primary) !important;
    background-color: var(--cbm-primary) !important;
    color: white !important;
}

.btn-primary,
.btn.btn-primary {
    background: var(--cbm-primary) !important;
    background-color: var(--cbm-primary) !important;
    border-color: var(--cbm-primary) !important;
    color: var(--cbm-dark) !important;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(135, 206, 235, 0.3);
}

.btn-primary:hover,
.btn.btn-primary:hover {
    background: var(--cbm-secondary) !important;
    background-color: var(--cbm-secondary) !important;
    border-color: var(--cbm-secondary) !important;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(135, 206, 235, 0.4);
}

.btn-success {
    background: var(--cbm-accent);
    border-color: var(--cbm-accent);
    color: white;
}

.btn-success:hover {
    background: var(--cbm-success);
    border-color: var(--cbm-success);
}

/* Warm Love-Inspired Button Styles */
.btn-love {
    background: var(--cbm-love-solid);
    border-color: var(--cbm-love);
    color: white;
    font-weight: 600;
    box-shadow: 0 4px 8px rgba(255, 107, 107, 0.3);
    transition: all 0.3s ease;
}

.btn-love:hover {
    background: var(--cbm-compassion);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(255, 107, 107, 0.4);
    color: white;
}

.btn-warmth {
    background: var(--cbm-warmth-solid);
    border-color: var(--cbm-warmth);
    color: var(--cbm-dark);
    font-weight: 600;
    box-shadow: 0 4px 8px rgba(255, 217, 61, 0.3);
}

.btn-warmth:hover {
    background: var(--cbm-grace);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(255, 217, 61, 0.4);
    color: var(--cbm-dark);
}

.btn-grace {
    background: var(--cbm-hope);
    border-color: var(--cbm-hope);
    color: var(--cbm-dark);
    font-weight: 600;
    box-shadow: 0 4px 8px rgba(255, 179, 71, 0.3);
}

.btn-grace:hover {
    background: var(--cbm-grace);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(255, 179, 71, 0.4);
    color: var(--cbm-dark);
}

/* Enhanced existing buttons with warm touches */
.btn-outline-success {
    border-color: var(--cbm-love);
    color: var(--cbm-love);
}

.btn-outline-success:hover {
    background-color: var(--cbm-love);
    border-color: var(--cbm-love);
    color: white;
}

.btn-warning {
    background: var(--cbm-warmth-solid);
    border-color: var(--cbm-warmth);
    color: var(--cbm-dark);
    font-weight: 600;
}

.btn-warning:hover {
    background: var(--cbm-grace);
    border-color: var(--cbm-grace);
    color: var(--cbm-dark);
}

/* Heavenly Navigation */
.navbar-brand img {
    max-height: 40px;
    width: auto;
    filter: drop-shadow(0 2px 4px rgba(255, 255, 255, 0.3));
}

.navbar-nav .nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
    color: rgba(255, 255, 255, 0.9) !important;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 0.25rem;
    color: white !important;
    transform: translateY(-1px);
}

/* Heavenly Dropdown Menus */
.dropdown-menu {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(135, 206, 235, 0.3);
    border-radius: 0.5rem;
    background: white;
}

.dropdown-item:hover {
    background: var(--cbm-info);
    color: var(--cbm-dark);
    border-radius: 0.375rem;
    transform: translateX(2px);
}

.dropdown-header {
    color: var(--cbm-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Heavenly Sidebar */
.sidebar {
    box-shadow: inset -3px 0 0 rgba(135, 206, 235, 0.3);
    min-height: calc(100vh - 80px);
    background: var(--cbm-light) !important;
    border-right: 2px solid var(--cbm-info);
}

.sidebar .nav-link {
    color: var(--cbm-dark);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    margin-bottom: 0.125rem;
    transition: all 0.2s ease;
    font-size: 0.9rem;
    border: none;
    background: transparent;
}

.sidebar .nav-link:hover {
    background-color: rgba(43, 79, 114, 0.1);
    color: var(--cbm-primary);
    transform: translateX(2px);
}

.sidebar .nav-link.active {
    background-color: var(--cbm-primary);
    color: white;
    font-weight: 600;
}

.sidebar .nav-link i {
    width: 16px;
    text-align: center;
}

/* Sidebar headings */
.sidebar-heading {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 0.5rem;
}

/* Collapsible sections in sidebar */
.sidebar .btn[data-bs-toggle="collapse"] {
    background: transparent;
    border: none;
    color: var(--cbm-dark);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 0.375rem;
    width: 100%;
    text-align: left;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
}

.sidebar .btn[data-bs-toggle="collapse"]:hover {
    background-color: rgba(43, 79, 114, 0.1);
    color: var(--cbm-primary);
}

.sidebar .btn[data-bs-toggle="collapse"]:not(.collapsed) {
    background-color: rgba(43, 79, 114, 0.15);
    color: var(--cbm-primary);
}

.sidebar .btn[data-bs-toggle="collapse"] .bi-chevron-down {
    transition: transform 0.2s ease;
}

.sidebar .btn[data-bs-toggle="collapse"]:not(.collapsed) .bi-chevron-down {
    transform: rotate(180deg);
}

/* Nested navigation links */
.sidebar .collapse .nav-link {
    padding-left: 2rem;
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 0.0625rem;
}

.sidebar .collapse .nav-link:hover {
    color: var(--cbm-primary);
    background-color: rgba(43, 79, 114, 0.05);
}

/* Horizontal rules in sidebar */
.sidebar hr {
    margin: 0.75rem 1rem;
    border-color: #dee2e6;
}

/* Content Area */
.content-area {
    min-height: 60vh;
}

/* Heavenly Tables - Responsive */
.table-responsive {
    border-radius: 0.5rem;
    box-shadow: 0 0.25rem 0.5rem rgba(135, 206, 235, 0.15);
    background: white;
    border: 1px solid var(--cbm-info);
}

.table th {
    background: var(--cbm-primary);
    color: white;
    border: none;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.table td {
    vertical-align: middle;
    border-color: var(--cbm-info);
    color: var(--cbm-dark);
}

.table-hover tbody tr:hover {
    background: rgba(135, 206, 235, 0.1);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(135, 206, 235, 0.2);
}

/* Heavenly Cards */
.card {
    border: 1px solid var(--cbm-info);
    box-shadow: 0 0.25rem 0.5rem rgba(135, 206, 235, 0.15);
    transition: all 0.3s ease;
    background: white;
    overflow: hidden;
}

.card:hover {
    box-shadow: 0 0.75rem 1.5rem rgba(135, 206, 235, 0.25);
    transform: translateY(-3px);
    border-color: var(--cbm-primary);
}

.card-header {
    background: var(--cbm-primary);
    color: white;
    font-weight: 600;
    border-bottom: 2px solid var(--cbm-accent);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.card-body {
    background: rgba(255, 255, 255, 0.95);
}

/* Heavenly Audio Player Enhancements */
audio {
    width: 100%;
    height: 45px;
    border-radius: 0.5rem;
    box-shadow: 0 0.25rem 0.5rem rgba(135, 206, 235, 0.2);
    border: 2px solid var(--cbm-info);
}

.audio-controls {
    background: white;
    border: 2px solid var(--cbm-info);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 0.5rem 1rem rgba(135, 206, 235, 0.2);
    margin: 1.5rem 0;
    position: relative;
    overflow: hidden;
}

.audio-controls::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--cbm-accent);
}

/* Heavenly Book/Message Lists */
.message-item, .book-item {
    background: white;
    border: 1px solid var(--cbm-info);
    border-radius: 0.5rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 0.25rem 0.5rem rgba(135, 206, 235, 0.15);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.message-item::before, .book-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--cbm-accent);
    transition: width 0.3s ease;
}

.message-item:hover, .book-item:hover {
    box-shadow: 0 0.75rem 1.5rem rgba(135, 206, 235, 0.25);
    transform: translateY(-2px);
    border-color: var(--cbm-primary);
    background: rgba(176, 224, 230, 0.3);
}

.message-item:hover::before, .book-item:hover::before {
    width: 8px;
}

.message-title, .book-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--cbm-secondary);
    text-decoration: none;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.message-title:hover, .book-title:hover {
    color: var(--cbm-primary);
    text-decoration: none;
    text-shadow: 0 1px 2px rgba(135, 206, 235, 0.5);
}

.message-meta, .book-meta {
    color: var(--cbm-dark);
    font-size: 0.9rem;
    margin-top: 0.5rem;
    opacity: 0.8;
}

/* Buttons */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.btn-outline-primary {
    color: var(--cbm-primary);
    border-color: var(--cbm-primary);
}

.btn-outline-primary:hover {
    background-color: var(--cbm-primary);
    border-color: var(--cbm-primary);
}

/* Heavenly Search Form */
.search-form {
    background: white;
    border: 2px solid var(--cbm-info);
    padding: 2.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 0.5rem 1rem rgba(135, 206, 235, 0.2);
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

.search-form::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--cbm-primary);
}

.search-form .form-label {
    font-weight: 600;
    color: var(--cbm-secondary);
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

.search-form .form-control {
    border: 2px solid var(--cbm-info);
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.search-form .form-control:focus {
    border-color: var(--cbm-primary);
    box-shadow: 0 0 0 0.2rem rgba(135, 206, 235, 0.25);
}

/* Footer */
footer {
    background-color: var(--cbm-dark) !important;
}

footer a {
    color: var(--cbm-light);
    text-decoration: none;
}

footer a:hover {
    color: var(--cbm-accent);
    text-decoration: underline;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .navbar-brand span {
        display: none;
    }
    
    .sidebar {
        position: fixed;
        top: 80px;
        left: -100%;
        width: 80%;
        height: calc(100vh - 80px);
        background-color: white;
        z-index: 1040;
        transition: left 0.3s ease;
    }
    
    .sidebar.show {
        left: 0;
    }
    
    .content-area {
        padding: 1rem 0.5rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .message-item, .book-item {
        padding: 0.75rem;
    }
    
    .search-form {
        padding: 1.5rem;
    }
}

/* Accessibility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Heavenly Focus States */
.btn:focus,
.form-control:focus,
.nav-link:focus {
    box-shadow: 0 0 0 0.25rem rgba(135, 206, 235, 0.4);
    outline: none;
}

.btn:focus {
    transform: translateY(-1px);
}

.form-control:focus {
    border-color: var(--cbm-primary);
    background: white;
}

/* Heavenly Loading Spinner */
.spinner-border-cbm {
    color: var(--cbm-primary);
    animation: spin 1s linear infinite, heavenly-glow 2s ease-in-out infinite alternate;
}

@keyframes heavenly-glow {
    0% {
        filter: drop-shadow(0 0 5px var(--cbm-primary));
    }
    100% {
        filter: drop-shadow(0 0 15px var(--cbm-accent));
    }
}

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

/* Heavenly Alerts */
.alert {
    border: none;
    border-radius: 0.5rem;
    border-left: 4px solid;
    box-shadow: 0 0.25rem 0.5rem rgba(135, 206, 235, 0.15);
}

.alert-info {
    background: var(--cbm-info);
    border-left-color: var(--cbm-primary);
    color: var(--cbm-dark);
}

.alert-success {
    background: var(--cbm-accent);
    border-left-color: var(--cbm-success);
    color: var(--cbm-dark);
}

.alert-primary {
    background: var(--cbm-primary);
    border-left-color: var(--cbm-secondary);
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Warm Love-Inspired Alerts */
.alert-love {
    background: var(--cbm-joy);
    border-left: 4px solid var(--cbm-love);
    color: var(--cbm-dark);
    border-radius: 0.5rem;
}

.alert-warmth {
    background: var(--cbm-gentle);
    border-left: 4px solid var(--cbm-warmth);
    color: var(--cbm-dark);
    border-radius: 0.5rem;
}

.alert-grace {
    background: var(--cbm-grace);
    border-left: 4px solid var(--cbm-hope);
    color: var(--cbm-dark);
    border-radius: 0.5rem;
}

/* Warm Card Accents */
.card-love {
    border-left: 4px solid var(--cbm-love);
    box-shadow: 0 4px 6px rgba(255, 107, 107, 0.1);
}

.card-love:hover {
    box-shadow: 0 8px 15px rgba(255, 107, 107, 0.2);
    transform: translateY(-2px);
}

.card-warmth {
    border-left: 4px solid var(--cbm-warmth);
    box-shadow: 0 4px 6px rgba(255, 217, 61, 0.1);
}

.card-warmth:hover {
    box-shadow: 0 8px 15px rgba(255, 217, 61, 0.2);
    transform: translateY(-2px);
}

.card-grace {
    border-left: 4px solid var(--cbm-hope);
    box-shadow: 0 4px 6px rgba(255, 179, 71, 0.1);
}

.card-grace:hover {
    box-shadow: 0 8px 15px rgba(255, 179, 71, 0.2);
    transform: translateY(-2px);
}

/* Warm header variants */
.card-header-love {
    background: var(--cbm-love-solid);
    color: white;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.card-header-warmth {
    background: var(--cbm-warmth-solid);
    color: var(--cbm-dark);
    font-weight: 600;
}

.card-header-grace {
    background: var(--cbm-hope);
    color: var(--cbm-dark);
    font-weight: 600;
}

/* Legacy Support - Override old styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    background: var(--cbm-light) !important;
    min-height: 100vh;
}

/* Ensure legacy tables work well */
table:not(.table) {
    width: 100%;
    margin-bottom: 1rem;
}

table:not(.table) td,
table:not(.table) th {
    padding: 0.5rem;
    border: 1px solid #dee2e6;
}

/* Chinese Font Support */
.chinese-text {
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', 'STHeiti', 'WenQuanYi Micro Hei', sans-serif;
}

/* Chinese Text Readability Improvements */
.chinese-text {
    line-height: 1.8;
    font-weight: 500;
}

/* Enhanced readability for Chinese text on colored backgrounds */
.bg-primary .chinese-text,
.text-white .chinese-text {
    text-shadow: 0 2px 4px rgba(0,0,0,0.4);
    font-weight: 600;
}

/* Hero sections with Chinese text */
.display-4.chinese-text {
    text-shadow: 0 3px 6px rgba(0,0,0,0.5);
    font-weight: 700;
}

.lead.chinese-text {
    text-shadow: 0 2px 4px rgba(0,0,0,0.4);
    font-weight: 500;
}

/* Card headers with Chinese text */
.card-header .chinese-text {
    font-weight: 600;
}

/* Better contrast for Chinese buttons */
.btn .chinese-text {
    font-weight: 600;
}

/* Responsive Chinese text sizing */
@media (max-width: 768px) {
    .chinese-text {
        font-size: 0.95rem;
        line-height: 1.7;
    }
    
    .display-4.chinese-text {
        font-size: 2.5rem;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .sidebar,
    footer {
        display: none !important;
    }
    
    main {
        margin-top: 0 !important;
    }
    
    .content-area {
        margin: 0 !important;
        padding: 0 !important;
    }
}