/* Mental Health Journal - Custom Styles */

:root {
    --primary-color: #4e73df;
    --secondary-color: #858796;
    --success-color: #1cc88a;
    --info-color: #36b9cc;
    --warning-color: #f6c23e;
    --danger-color: #e74a3b;
    --light-color: #f8f9fc;
    --dark-color: #5a5c69;
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Performance optimizations */
* {
    box-sizing: border-box;
}

img {
    max-width: 100%;
    height: auto;
    loading: lazy;
}

/* Reduce reflows and repaints */
.container, .row, .col {
    will-change: auto;
}

/* Global Styles */
body {
    font-family: var(--font-family);
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    margin-bottom: 1rem;
}

.display-4 {
    font-weight: 700;
}

.lead {
    font-size: 1.15rem;
    font-weight: 400;
}

/* Navigation */
.navbar {
    background-color: #fff !important;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    transition: all 0.3s ease;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--primary-color) !important;
}

.navbar-nav .nav-link {
    font-weight: 500;
    color: #5a5c69 !important;
    transition: color 0.3s ease;
    position: relative;
}

.navbar-nav .nav-link:hover {
    color: var(--primary-color) !important;
}

.navbar-nav .nav-link.active {
    color: var(--primary-color) !important;
}

.navbar-nav .nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background-color: var(--primary-color);
    border-radius: 1px;
}

/* Buttons */
.btn {
    border-radius: 0.35rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-transform: none;
}

.btn-primary {
    background: linear-gradient(45deg, #4e73df, #224abe);
    border: none;
    box-shadow: 0 0.125rem 0.25rem 0 rgba(58, 59, 69, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(45deg, #224abe, #1e3a8a);
    transform: translateY(-2px);
    box-shadow: 0 0.375rem 0.75rem 0 rgba(58, 59, 69, 0.3);
}

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

.btn-outline-primary:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

/* Cards */
.card {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.15);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0.375rem 2rem 0 rgba(58, 59, 69, 0.2);
}

.card-header {
    background-color: #f8f9fc;
    border-bottom: 1px solid #e3e6f0;
    font-weight: 600;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, #4e73df 0%, #224abe 100%);
    min-height: 60vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 120" preserveAspectRatio="none"><path d="M1200 120L0 16.48V0h1200v120z" fill="rgba(255,255,255,0.1)"/></svg>') no-repeat bottom;
    background-size: cover;
}

.hero-section .container {
    position: relative;
    z-index: 2;
}

.hero-image svg {
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.1));
}

/* Subscription Banner */
.subscription-banner {
    border-bottom: 1px solid #e3e6f0;
    background: linear-gradient(90deg, #f8f9fc 0%, #fff 100%);
}

/* Section Titles */
.section-title {
    font-weight: 700;
    color: #5a5c69;
    position: relative;
    padding-bottom: 0.5rem;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--info-color));
    border-radius: 2px;
}

/* Articles */
.article-card {
    transition: all 0.3s ease;
    height: 100%;
}

.article-card:hover {
    transform: translateY(-5px);
}

.article-meta {
    font-size: 0.875rem;
}

.article-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #495057;
}

.article-content p {
    margin-bottom: 1.5rem;
}

.article-excerpt {
    font-style: italic;
    padding: 1rem;
    background-color: #f8f9fc;
    border-left: 4px solid var(--primary-color);
    margin-bottom: 2rem;
}

/* Advertisements */
.ad-container {
    position: relative;
    overflow: hidden;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
}

.ad-container:hover {
    transform: scale(1.02);
    box-shadow: 0 0.375rem 1rem 0 rgba(58, 59, 69, 0.2);
}

.ad-container img {
    width: 100%;
    height: auto;
    display: block;
}

/* Carousel Styles */
.carousel-control-prev,
.carousel-control-next {
    width: 5%;
    background: linear-gradient(to right, rgba(0,0,0,0.1), transparent);
}

.carousel-control-next {
    background: linear-gradient(to left, rgba(0,0,0,0.1), transparent);
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    background-color: var(--primary-color);
    border-radius: 50%;
    width: 30px;
    height: 30px;
}

/* Forms */
.form-control {
    border-radius: 0.5rem;
    border: 1px solid #d1d3e2;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(78, 115, 223, 0.25);
}

.form-select {
    border-radius: 0.5rem;
    border: 1px solid #d1d3e2;
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.5em 0.75em;
}

/* Alerts */
.alert {
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
}

.alert-success {
    background-color: rgba(28, 200, 138, 0.1);
    color: #0f5132;
    border-left: 4px solid var(--success-color);
}

.alert-danger {
    background-color: rgba(231, 74, 59, 0.1);
    color: #842029;
    border-left: 4px solid var(--danger-color);
}

.alert-info {
    background-color: rgba(54, 185, 204, 0.1);
    color: #055160;
    border-left: 4px solid var(--info-color);
}

.alert-warning {
    background-color: rgba(246, 194, 62, 0.1);
    color: #664d03;
    border-left: 4px solid var(--warning-color);
}

/* Digital Magazine Styles */
.magazine-container {
    position: relative;
    z-index: 1;
    background: #fff;
}

.magazine-embed {
    position: relative;
    z-index: 10;
    overflow: hidden;
}

#magazineFrame {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 15;
    background: #fff;
}

#magazineLoader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    background: #f8f9fa;
}

/* Footer */
footer {
    background-color: #2d3748 !important;
    margin-top: auto;
}

footer h5, footer h6 {
    color: #fff !important;
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.social-links a:hover {
    background-color: var(--primary-color);
    transform: translateY(-2px);
}

/* Newsletter Form */
.newsletter-form .input-group {
    border-radius: 0.5rem;
    overflow: hidden;
}

.newsletter-form .form-control {
    border: none;
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 0;
}

.newsletter-form .form-control::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.newsletter-form .btn {
    border-radius: 0;
    border: none;
}

/* Admin Styles */
.sidebar {
    background-color: #f8f9fc !important;
    border-right: 1px solid #e3e6f0;
    min-height: calc(100vh - 56px);
}

.sidebar .nav-link {
    color: #5a5c69;
    font-weight: 500;
    padding: 0.75rem 1rem;
    border-radius: 0.35rem;
    margin-bottom: 0.25rem;
}

.sidebar .nav-link:hover {
    background-color: #eaecf4;
    color: var(--primary-color);
}

.sidebar .nav-link.active {
    background-color: var(--primary-color);
    color: #fff;
}

/* Stats Cards */
.border-left-primary {
    border-left: 0.25rem solid var(--primary-color) !important;
}

.border-left-success {
    border-left: 0.25rem solid var(--success-color) !important;
}

.border-left-info {
    border-left: 0.25rem solid var(--info-color) !important;
}

.border-left-warning {
    border-left: 0.25rem solid var(--warning-color) !important;
}

.border-left-danger {
    border-left: 0.25rem solid var(--danger-color) !important;
}

/* Avatar Styles */
.avatar-sm {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 0.875rem;
}

.avatar-md {
    width: 3rem;
    height: 3rem;
    font-size: 1rem;
}

.avatar-lg {
    width: 5rem;
    height: 5rem;
    font-size: 1.5rem;
}

/* Modal Styles */
.modal-content {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 0.5rem 2rem 0 rgba(58, 59, 69, 0.3);
}

.modal-header {
    background-color: #f8f9fc;
    border-bottom: 1px solid #e3e6f0;
    border-radius: 0.75rem 0.75rem 0 0;
}

/* Table Styles */
.table {
    margin-bottom: 0;
}

.table th {
    border-top: none;
    font-weight: 600;
    color: #5a5c69;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.table-hover tbody tr:hover {
    background-color: #f8f9fc;
}

/* Pagination */
.pagination .page-link {
    color: var(--primary-color);
    border-color: #e3e6f0;
    border-radius: 0.35rem;
    margin: 0 0.125rem;
}

.pagination .page-link:hover {
    background-color: #eaecf4;
    border-color: #d1d3e2;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Utility Classes */
.text-xs {
    font-size: 0.75rem;
}

.font-weight-bold {
    font-weight: 700 !important;
}

.text-gray-300 {
    color: #d1d3e2 !important;
}

.text-gray-800 {
    color: #5a5c69 !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-section {
        min-height: 50vh;
        text-align: center;
    }
    
    .hero-section h1 {
        font-size: 2.5rem;
    }
    
    .subscription-banner {
        text-align: center;
    }
    
    .subscription-banner .row > div {
        margin-bottom: 1rem;
    }
    
    .card-columns {
        column-count: 1;
    }
    
    .sidebar {
        min-height: auto;
    }
}

@media (max-width: 576px) {
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .hero-section .lead {
        font-size: 1rem;
    }
    
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #e3e6f0 !important;
    }
    
    .btn {
        display: none !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid #000;
    }
    
    .btn-primary {
        background-color: #000;
        border-color: #000;
    }
    
    .text-muted {
        color: #333 !important;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Focus Styles for Accessibility */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Skip to Content Link */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 1000;
    border-radius: 4px;
}

.skip-link:focus {
    top: 6px;
}
