/* General styling */
body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #f5f8f6;
    margin: 0;
    padding: 0;
    font-family: 'Vazirmatn', 'Tahoma', sans-serif;
}

main {
    flex: 1 0 auto;
    margin-bottom: 60px; /* Add space for the footer */
}

/* Card styling */
.card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 20px;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1) !important;
}

.card-img-top {
    height: 180px;
    object-fit: cover;
}

/* Course card specific */
.course-card {
    height: 100%;
}

.course-card .card-body {
    display: flex;
    flex-direction: column;
}

.course-card .card-footer {
    margin-top: auto;
    background-color: transparent;
    border-top: none;
    padding-top: 0;
}

.course-locked {
    position: relative;
}

.course-locked::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-title-box {
    border: 1px solid #2fd89a;
    border-radius: 0.5rem;
    padding: 0.5rem;
    color: white;
    background-color: #2fd89a;
    font-weight: 700;
    text-align: center;
}

.course-locked .lock-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    color: white;
    z-index: 10;
}

/* Course card specific */
.course-card-horizontal {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.course-card-horizontal:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1) !important;
}

.course-card-horizontal .card-body {
    padding: 1rem;
}

.course-card-horizontal img {
    height: 100%;
    min-height: 140px;
    object-fit: cover;
}

/* Course locked state */
.course-card-horizontal.course-locked {
    position: relative;
    cursor: not-allowed;
}

.course-card-horizontal.course-locked::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.1);
    pointer-events: none;
}

.course-card-horizontal .lock-icon {
    position: absolute;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
    font-size: 1.5rem;
    color: #6c757d;
    z-index: 10;
}

/* Make unlocked courses clickable */
a:hover .course-card-horizontal {
    cursor: pointer;
}

/* Button hover effects */
.btn {
    transition: all 0.3s ease;
    border-radius: 50px;
    padding: 0.5rem 1.5rem;
    font-weight: 500;
}

/* Form styling */
.form-control:focus, .form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Custom styles for auth pages */
.auth-container {
    max-width: 500px;
    margin: 2rem auto;
}

/* Footer styling */
.footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #2fd89a;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.footer-icon {
    display: block;
    text-align: center;
    width: 33%;
    color: white;
    text-decoration: none;
    padding: 8px 0;
    position: relative;  /* Added for badge positioning */
}

.footer-icon:hover, .footer-icon:active {
    color: #0d6efd;
}

.footer-icon i {
    font-size: 1.5rem;
    display: block;
    margin-bottom: 4px;
}

/* Basket badge in footer */
.basket-badge {
    font-size: 12px !important;
    padding: 0 !important;
    width: 22px !important;
    height: 22px !important;
    display: flex;
    align-items: center !important;
    justify-content: center !important;
    margin-top: -8px !important;
    margin-left: -8px !important;
    z-index: 100;
    border: 2px solid white !important;
}

/* Navigation styling */
.navbar { 
    background-color: #2fd89a;
    
}
.navbar-brand {
    font-size: 1.5rem !important;
    font-weight: 700;
}

.nav-link {
    font-weight: 500;
}

/* Profile page styling */
.avatar-placeholder {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Badge and progress indicators */
.progress {
    height: 8px;
    border-radius: 4px;
}

.badge {
    font-weight: 500;
    padding: 0.4em 0.8em;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    .container-review {
        padding-left: 8px;
        padding-right: 8px;
    }
    
    h1, .h1 {
        font-size: 1.8rem;
    }
    
    h2, .h2 {
        font-size: 1.5rem;
    }
    
    .card {
        margin-bottom: 15px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    body.dark-mode {
        background-color: #121212;
        color: #e0e0e0;
    }
    
    body.dark-mode .card {
        background-color: #1e1e1e;
        border-color: #333;
    }
    
    body.dark-mode .bg-light {
        background-color: #1e1e1e !important;
    }
    
    body.dark-mode .text-muted {
        color: #adb5bd !important;
    }
}

/* Header menu positioning */
.navbar .container-fluid {
    justify-content: space-between;
    gap: 1rem;
}

.navbar-collapse {
    flex-grow: 0;
}

/* Mobile header adjustments */
@media (max-width: 991.98px) {
    .navbar-toggler {
        margin-right: 0;
    }

    .navbar .dropdown {
        margin-right: 1rem;
    }

    .navbar-collapse {
        position: absolute;
        top: 100%;
        right: 0;
        left: 0;
        background-color: #0d6efd;
        padding: 1rem;
        z-index: 1000;
    }

    .navbar .username-center {
        display: none;
    }
}

/* Desktop header adjustments */
@media (min-width: 992px) {
    .navbar-collapse {
        margin-left: auto;
    }
}

/* Header styling */
.header-logo {
    height: 60px;
    width: auto;
    max-width: 240px;
    object-fit: contain;
}

/* Username container styling */
.username-container {
    flex: 1;
    text-align: center;
    margin: 0 1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 576px) {
    .header-logo {
        height: 48px;
        max-width: 200px;
    }

    .navbar-brand {
        font-size: 1.2rem !important;
    }

    .username-container {
        margin: 0 0.5rem;
        font-size: 0.9rem;
    }
}

/* Animations */
@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

.fade-out {
    animation: fadeOut 0.5s forwards;
    pointer-events: none;
}

/* RTL and Farsi text enhancements */
html[dir="rtl"] {
    font-feature-settings: "ss01";
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Enhance legibility for headings */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Vazirmatn', 'Tahoma', sans-serif;
    font-weight: 700;
    line-height: 1.5;
}

/* Purchase basket styling */
.basket-icon {
    position: fixed;
    bottom: 80px;  /* Increased to be above the footer */
    left: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #198754;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    z-index: 1050;  /* Increased z-index to be above other elements */
    transition: all 0.3s ease;
    text-decoration: none;  /* Added to remove underline from link */
}

.basket-icon:hover {
    transform: scale(1.1);
    background-color: #0d6efd;
    color: white;  /* Added to keep text white on hover */
    text-decoration: none;  /* Added to remove underline on hover */
}

.basket-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #dc3545;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
    z-index: 1051;  /* Higher than basket-icon to ensure it's always visible */
}

.add-to-basket-btn {
    transition: all 0.3s ease;
}

.add-to-basket-btn:hover {
    transform: translateY(-2px);
}

.basket-item {
    transition: all 0.3s ease;
}

.basket-item.fade-out {
    opacity: 0;
    transform: translateX(20px);
}

@media (max-width: 767.98px) {
    .basket-icon {
        width: 50px;
        height: 50px;
        bottom: 20px;
        left: 20px;
    }
    
    .basket-count {
        width: 20px;
        height: 20px;
        font-size: 10px;
    }
}

/* Admin courses page button layout fixes */
@media (min-width: 768px) {
    .card-body .btn-group {
        display: flex;
        flex-wrap: wrap;
        gap: 0.25rem;
    }
    
    .card-body .btn-group .btn {
        flex: 0 0 auto;
        min-width: 40px;
        padding: 0.375rem 0.5rem;
    }
    
    .card-body .d-grid.gap-2 {
        display: flex !important;
        flex-direction: column;
        gap: 0.5rem !important;
    }
    
    .card-body .d-grid.gap-2 .btn-group {
        justify-content: flex-end;
    }
}

@media (min-width: 992px) {
    .card-body .btn-group .btn {
        min-width: 45px;
        padding: 0.375rem 0.75rem;
    }
    
    .card-body .btn-group .btn .d-none.d-md-inline {
        display: inline !important;
    }
}