/* Knowledge Hub Specific Styles */
/* Separated from main HTML for better performance and maintainability */

/* Knowledge Hub Animations */
@keyframes pulse-knowledge {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes knowledge-fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes knowledge-shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Video Info Toast Animation */
@keyframes animate-fade-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-fade-in {
    animation: animate-fade-in 0.3s ease-out;
}

/* Video Player Modal Styles */
.video-player-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    backdrop-filter: blur(4px);
}

.video-player-container {
    background: white;
    border-radius: 0.75rem;
    overflow: hidden;
    max-width: 64rem;
    width: 100%;
    max-height: 90vh;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: videoModalAppear 0.3s ease-out;
}

@keyframes videoModalAppear {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.video-player-header {
    background: #f8fafc;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #e2e8f0;
}

.video-player-header h3 {
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    font-size: 1.125rem;
}

.video-player-header button {
    color: #6b7280;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}

.video-player-header button:hover {
    color: #374151;
    background: #e5e7eb;
}

.video-player-content {
    position: relative;
}

.video-player-content .aspect-video {
    aspect-ratio: 16 / 9;
    background: #000;
}

.video-player-content iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.video-player-footer {
    background: #f9fafb;
    padding: 1rem 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.video-player-footer .flex {
    display: flex;
}

.video-player-footer .items-center {
    align-items: center;
}

.video-player-footer .justify-between {
    justify-content: space-between;
}

.video-player-footer .space-x-4 > * + * {
    margin-left: 1rem;
}

.video-player-footer .space-x-2 > * + * {
    margin-left: 0.5rem;
}

.video-player-footer .text-sm {
    font-size: 0.875rem;
}

.video-player-footer .text-xs {
    font-size: 0.75rem;
}

.video-player-footer .text-gray-600 {
    color: #4b5563;
}

.video-player-footer .text-gray-700 {
    color: #374151;
}

.video-player-footer .text-gray-500 {
    color: #6b7280;
}

.video-player-footer button {
    background: #dc2626;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: inline-flex;
    align-items: centers;
}

.video-player-footer button:hover {
    background: #b91c1c;
}

.video-player-footer button i {
    margin-right: 0.25rem;
}

/* Enhanced Video Tutorial Card Styles */
.video-tutorial-card {
    position: relative;
    border-radius: 0.75rem;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.video-tutorial-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.video-tutorial-card .aspect-video {
    aspect-ratio: 16 / 9;
    position: relative;
    overflow: hidden;
}

.video-tutorial-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.video-tutorial-card:hover img {
    transform: scale(1.05);
}

.video-tutorial-card .play-button {
    font-size: 3rem;
    color: white;
    opacity: 0.9;
    transition: all 0.3s ease;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.3));
}

.video-tutorial-card:hover .play-button {
    opacity: 1;
    transform: scale(1.1);
    color: #ef4444;
}

.video-tutorial-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.4), transparent);
    padding: 1rem;
    color: white;
}

.video-tutorial-overlay h4 {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    line-height: 1.3;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.video-tutorial-overlay p {
    font-size: 0.75rem;
    color: #e2e8f0;
    margin: 0;
    opacity: 0.9;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Enhanced Video Badges */
.video-tutorial-card .absolute {
    position: absolute;
}

.video-tutorial-card .top-2 {
    top: 0.5rem;
}

.video-tutorial-card .bottom-2 {
    bottom: 0.5rem;
}

.video-tutorial-card .right-2 {
    right: 0.5rem;
}

.video-tutorial-card .bg-black {
    background: rgba(0, 0, 0, 0.75);
}

.video-tutorial-card .bg-red-600 {
    background: #dc2626;
}

.video-tutorial-card .bg-opacity-75 {
    background-opacity: 0.75;
}

.video-tutorial-card .text-white {
    color: white;
}

.video-tutorial-card .text-xs {
    font-size: 0.75rem;
}

.video-tutorial-card .px-2 {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.video-tutorial-card .py-1 {
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
}

.video-tutorial-card .rounded {
    border-radius: 0.25rem;
}

.video-tutorial-card .flex {
    display: flex;
}

.video-tutorial-card .items-center {
    align-items: center;
}

/* Responsive Video Player */
@media (max-width: 768px) {
    .video-player-modal {
        padding: 0.5rem;
    }
    
    .video-player-container {
        max-height: 95vh;
    }
    
    .video-player-header,
    .video-player-footer {
        padding: 0.75rem 1rem;
    }
    
    .video-player-footer .space-x-4 > * + * {
        margin-left: 0.5rem;
    }
    
    .video-player-footer .text-sm {
        font-size: 0.8rem;
    }
    
    .video-tutorial-card .play-button {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    .video-player-footer {
        padding: 0.5rem;
    }
    
    .video-player-footer .flex {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .video-player-footer .justify-between {
        justify-content: flex-start;
    }
    
    .video-tutorial-card .play-button {
        font-size: 2rem;
    }
    
    .video-tutorial-overlay {
        padding: 0.75rem;
    }
    
    .video-tutorial-overlay h4 {
        font-size: 0.8rem;
    }
    
    .video-tutorial-overlay p {
        font-size: 0.7rem;
    }
}

/* Knowledge Hub Utility Classes */
.knowledge-pulse {
    animation: pulse-knowledge 3s infinite;
}

.fade-in {
    animation: knowledge-fadeIn 0.5s ease-out;
}

.knowledge-card {
    transition: all 0.3s ease;
    border-radius: 0.75rem;
    background: white;
    border: 1px solid rgba(0,0,0,0.05);
}

.knowledge-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.12);
}

/* Category Cards */
.category-card {
    transition: all 0.3s ease;
    cursor: pointer;
    border-radius: 0.75rem;
    background: white;
    padding: 1rem;
    text-align: center;
}

.category-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

/* Article Cards */
.article-card {
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
}

.article-card:hover {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Video Info Toast Styles */
.video-info-toast {
    animation: animate-fade-in 0.3s ease-out;
    transition: all 0.3s ease;
}

.video-info-toast .video-info-card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border: 1px solid #e5e7eb;
    max-width: 24rem;
}

.video-info-header {
    display: flex;
    align-items: center;
    space-x: 0.75rem;
    margin-bottom: 0.75rem;
}

.video-info-icon {
    width: 3rem;
    height: 3rem;
    background: #dbeafe;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-info-icon i {
    color: #2563eb;
    font-size: 1.25rem;
}

.video-info-meta {
    flex: 1;
}

.video-info-meta h4 {
    font-weight: 700;
    color: #1f2937;
    font-size: 0.875rem;
    margin: 0;
}

.video-info-meta p {
    color: #6b7280;
    font-size: 0.75rem;
    margin: 0;
}

.video-title {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.video-stats {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.video-stat-row {
    display: flex;
    justify-content: space-between;
}

.video-stat-label {
    color: #6b7280;
}

.video-stat-value {
    font-weight: 500;
    color: #374151;
}

.video-description {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.75rem;
    line-height: 1.4;
}

.video-close-button {
    width: 100%;
    background: #2563eb;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.video-close-button:hover {
    background: #1d4ed8;
}

/* Reading Progress Bar */
.reading-progress {
    width: 0%;
    height: 4px;
    background: linear-gradient(90deg, #4f46e5, #7c3aed);
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* Bookmark Animation */
.bookmark-icon {
    transition: all 0.2s ease;
    cursor: pointer;
}

.bookmark-icon:hover {
    transform: scale(1.2);
}

.bookmark-icon i {
    transition: color 0.2s ease;
}

/* Resource Grid */
.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

/* Offline Indicator */
.offline-indicator {
    display: none;
    background: #fef3c7;
    color: #92400e;
    padding: 0.5rem 1rem;
    text-align: center;
    border-bottom: 1px solid #f59e0b;
}

.offline .offline-indicator {
    display: block;
}

/* Sidebar Styles */
#sidebar {
    display: block !important;
    width: 16rem;
    background: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border-right: 1px solid #e5e7eb;
    overflow-y: auto;
    height: 100vh;
    position: sticky;
    top: 0;
}

@media (max-width: 767px) {
    #sidebar.mobile-hidden {
        display: none !important;
    }
    
    #sidebar {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 40;
        height: 100vh;
    }
}

/* Navigation Items */
.nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    transition: all 0.15s ease-in-out;
    text-decoration: none;
    color: #374151;
    margin: 0.125rem 0;
}

.nav-item:hover {
    background: rgba(79, 70, 229, 0.05);
    color: #4f46e5;
}

.nav-item.active {
    background: rgba(79, 70, 229, 0.1);
    color: #4f46e5;
    border: 1px solid rgba(79, 70, 229, 0.2);
    font-weight: 500;
}

.nav-item i {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.75rem;
    color: #9ca3af;
}

.nav-item.active i {
    color: #4f46e5;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-content {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 0 0 0.75rem 0.75rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    color: #374151;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.form-input, .form-select {
    width: 100%;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: all 0.15s ease-in-out;
    background: white;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease-in-out;
    cursor: pointer;
    border: 2px solid transparent;
    font-size: 0.875rem;
}

.btn-primary {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.btn-secondary {
    background: white;
    color: #4f46e5;
    border-color: #e5e7eb;
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: #4f46e5;
}

/* Alert/Toast Styles */
.toast {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    color: white;
    z-index: 1000;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 20rem;
}

.toast.success {
    background: linear-gradient(135deg, #10b981, #059669);
}

.toast.error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.toast.warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.toast.info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

/* Loading States */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: white;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

.loading-spinner {
    width: 3rem;
    height: 3rem;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #4f46e5;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: knowledge-shimmer 1.5s infinite;
    border-radius: 0.25rem;
}

.skeleton-text {
    height: 1rem;
    margin: 0.5rem 0;
}

.skeleton-title {
    height: 1.5rem;
    width: 60%;
    margin-bottom: 1rem;
}

/* Featured Content Hero */
.hero-featured {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    border-radius: 0.75rem;
    padding: 2rem;
    color: white;
    position: relative;
    overflow: hidden;
}

.hero-featured::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 2s;
}

.hero-featured:hover::before {
    left: 100%;
}

/* Search Input */
.search-input {
    position: relative;
}

.search-input input {
    padding-left: 2.5rem;
    width: 16rem;
}

.search-input i {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
}

/* Badge Styles */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-error {
    background: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

/* Responsive Utilities */
.grid-auto-fit {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.grid-auto-fill {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

/* Text Utilities */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Print Styles */
@media print {
    .no-print, .btn, .modal, .toast, .video-player-modal {
        display: none !important;
    }
    
    .knowledge-card {
        box-shadow: none;
        border: 1px solid #ccc;
        break-inside: avoid;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .dark-mode .knowledge-card {
        background: #374151;
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .dark-mode #sidebar {
        background: #1f2937;
        border-color: #374151;
    }
    
    .dark-mode .nav-item {
        color: #d1d5db;
    }
    
    .dark-mode .nav-item:hover {
        background: rgba(79, 70, 229, 0.2);
    }
    
    .dark-mode .video-player-container {
        background: #1f2937;
        color: #f9fafb;
    }
    
    .dark-mode .video-player-header {
        background: #374151;
        border-bottom-color: #4b5563;
    }
    
    .dark-mode .video-player-footer {
        background: #374151;
        border-top-color: #4b5563;
    }
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    .knowledge-card,
    .category-card,
    .article-card,
    .bookmark-icon,
    .btn,
    .video-tutorial-card {
        transition: none;
    }
    
    .knowledge-pulse,
    .fade-in,
    .animate-fade-in,
    .video-player-container {
        animation: none;
    }
}

/* Focus Indicators */
.knowledge-card:focus,
.category-card:focus,
.article-card:focus,
.video-tutorial-card:focus {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

.video-player-modal:focus-within .video-player-container {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

/* Calculator Quick Button Styles */
.calculator-quick-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
}

.calculator-quick-btn:hover {
    border-color: #4f46e5;
    background: #f8fafc;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.calculator-quick-btn:active {
    transform: translateY(0);
}

/* Calculator Modal Specific Styles */
.calculator-modal .modal {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-height: 90vh;
    overflow-y: auto;
}

.calculator-modal .modal-header {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-bottom: 1px solid #e2e8f0;
    padding: 1.5rem;
    border-radius: 1rem 1rem 0 0;
}

.calculator-modal .modal-content {
    padding: 1.5rem;
}

/* Calculator Form Styles */
.calculator-modal .form-group {
    margin-bottom: 1rem;
}

.calculator-modal .form-label {
    display: block;
    color: #374151;
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.calculator-modal .form-input,
.calculator-modal .form-select {
    width: 100%;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: all 0.15s ease-in-out;
    background: white;
}

.calculator-modal .form-input:focus,
.calculator-modal .form-select:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Calculator Results Styles */
.calculator-modal #calculator-results {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Badge Styles for Categories */
.badge-crops {
    background: #d1fae5;
    color: #065f46;
}

.badge-livestock {
    background: #fed7aa;
    color: #9a3412;
}

.badge-soil {
    background: #fef3c7;
    color: #92400e;
}

.badge-climate {
    background: #dbeafe;
    color: #1e40af;
}

.badge-pest {
    background: #fee2e2;
    color: #991b1b;
}

.badge-business {
    background: #e9d5ff;
    color: #7c2d12;
}

/* Learning Progress Enhancements */
.learning-progress-bar {
    background: linear-gradient(90deg, #4f46e5, #7c3aed);
    transition: width 0.5s ease;
    position: relative;
    overflow: hidden;
}

.learning-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Enhanced Search Input */
.search-input {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input input {
    padding-left: 2.5rem;
    padding-right: 5rem;
    width: 16rem;
    transition: width 0.3s ease;
}

.search-input input:focus {
    width: 20rem;
}

.search-input i {
    position: absolute;
    color: #9ca3af;
    z-index: 10;
}

.search-input button {
    position: absolute;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    z-index: 10;
    transition: color 0.2s ease;
}

.search-input button:hover {
    color: #4f46e5;
}

/* Voice Search Animation */
.search-input button.listening {
    color: #ef4444;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Advanced Search Panel */
.advanced-search-panel {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* PWA Install Banner */
.pwa-install-banner {
    background: linear-gradient(135deg, #4d7c0f, #16a34a);
    color: white;
    padding: 0.75rem 1rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    animation: slideDown 0.5s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
    }
    to {
        transform: translateY(0);
    }
}

.pwa-install-banner button {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pwa-install-banner button:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Connection Status */
.connection-status {
    background: #f59e0b;
    color: white;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.875rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 40;
}

.connection-status.online {
    background: #10b981;
}

.connection-status.offline {
    background: #ef4444;
}

/* Enhanced Article Cards */
.article-card {
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 1rem;
    background: white;
    position: relative;
    overflow: hidden;
}

.article-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, #4f46e5, #7c3aed);
    transition: left 0.3s ease;
}

.article-card:hover::before {
    left: 0;
}

.article-card:hover {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

/* Reading Progress Indicator */
.reading-progress {
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.reading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4f46e5, #7c3aed);
    border-radius: 2px;
    transition: width 0.3s ease;
    position: relative;
}

.reading-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: progress-shimmer 2s infinite;
}

@keyframes progress-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Bookmark Animation */
.bookmark-icon {
    transition: all 0.2s ease;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 0.25rem;
}

.bookmark-icon:hover {
    background: rgba(79, 70, 229, 0.1);
    transform: scale(1.1);
}

.bookmark-icon.bookmarked {
    color: #4f46e5;
    animation: bookmarkSaved 0.5s ease;
}

@keyframes bookmarkSaved {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

/* Enhanced Video Cards */
.video-tutorial-card {
    position: relative;
    border-radius: 0.75rem;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    background: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.video-tutorial-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.video-tutorial-card:hover .play-button {
    transform: scale(1.1);
    color: #ef4444;
}

.video-tutorial-card .play-button {
    transition: all 0.3s ease;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

/* Learning Path Steps */
.learning-path-step {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    border-radius: 0.5rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.learning-path-step:hover {
    background: rgba(79, 70, 229, 0.05);
}

.learning-path-step.completed {
    background: rgba(16, 185, 129, 0.1);
}

.learning-path-step.current {
    background: rgba(79, 70, 229, 0.1);
    border: 1px solid rgba(79, 70, 229, 0.2);
}

/* Knowledge Stats Animation */
.knowledge-stat {
    transition: all 0.3s ease;
}

.knowledge-stat:hover {
    transform: scale(1.05);
}

.knowledge-stat-value {
    font-weight: 700;
    font-size: 1.1em;
    color: #4f46e5;
    transition: color 0.3s ease;
}

.knowledge-stat:hover .knowledge-stat-value {
    color: #7c3aed;
}

/* Enhanced Category Cards */
.category-card {
    transition: all 0.3s ease;
    cursor: pointer;
    border-radius: 0.75rem;
    background: white;
    padding: 1rem;
    text-align: center;
    border: 1px solid transparent;
    position: relative;
    overflow: hidden;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, currentColor, transparent);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
}

.category-card:hover::before {
    transform: translateX(100%);
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
    border-color: rgba(79, 70, 229, 0.2);
}

.category-card.trending {
    border-color: #ef4444;
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.1);
}

/* Mobile Sidebar Styles */
.mobile-hidden {
    transform: translateX(-100%) !important;
}

.mobile-show {
    transform: translateX(0) !important;
}

/* Mobile Modal Styles */
.mobile-modal {
    padding: 0.5rem !important;
}

.mobile-modal-content {
    margin: 0 !important;
    max-width: none !important;
    width: calc(100vw - 1rem) !important;
    max-height: calc(100vh - 1rem) !important;
    border-radius: 0.75rem !important;
}

/* Mobile Form Styles */
.form-input-mobile,
.form-select-mobile {
    width: 100%;
    padding: 0.875rem;
    font-size: 16px; /* Prevents zoom on iOS */
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    background: white;
    transition: border-color 0.15s ease-in-out;
}

.form-input-mobile:focus,
.form-select-mobile:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Toast Mobile Styles */
.toast-mobile {
    left: 0.5rem !important;
    right: 0.5rem !important;
    bottom: 0.5rem !important;
    width: auto !important;
    min-width: auto !important;
}

/* Mobile Layout Fixes */
@media (max-width: 768px) {
    /* Ensure proper z-index stacking */
    #sidebar {
        z-index: 50;
    }
    
    .sidebar-overlay {
        z-index: 45;
    }
    
    /* Fix for viewport units on mobile */
    .min-h-screen {
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }
    
    /* Mobile navigation fixes */
    .nav-item {
        padding: 0.875rem !important;
        margin: 0.125rem 0 !important;
        touch-action: manipulation;
    }
    
    /* Mobile content spacing */
    .space-y-6 > * + * {
        margin-top: 1.5rem !important;
    }
    
    .space-y-4 > * + * {
        margin-top: 1rem !important;
    }
    
    /* Mobile grid improvements */
    .grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-cols-1 {
        grid-template-columns: 1fr;
    }
    
    /* Mobile button improvements */
    .btn {
        padding: 0.875rem 1.25rem;
        font-size: 1rem;
        min-height: 44px;
        touch-action: manipulation;
    }
    
    /* Mobile card improvements */
    .knowledge-card,
    .article-card,
    .category-card {
        border-radius: 0.75rem;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        transition: none; /* Remove hover effects on mobile */
    }
    
    /* Mobile text size adjustments */
    h1 { font-size: 1.875rem !important; }
    h2 { font-size: 1.5rem !important; }
    h3 { font-size: 1.25rem !important; }
    h4 { font-size: 1.125rem !important; }
    
    /* Mobile specific utilities */
    .mobile-center {
        text-align: center;
    }
    
    .mobile-full-width {
        width: 100%;
    }
    
    .mobile-hidden-important {
        display: none !important;
    }
    
    .mobile-block {
        display: block !important;
    }
    
    /* Mobile loading overlay */
    .loading-overlay {
        position: fixed !important;
        inset: 0 !important;
        background: rgba(255, 255, 255, 0.95) !important;
        z-index: 9999 !important;
    }
    
    /* Mobile article modal */
    .article-modal .modal {
        margin: 0.5rem;
        max-height: calc(100vh - 1rem);
        border-radius: 0.75rem;
    }
    
    .article-modal .modal-content {
        max-height: calc(100vh - 8rem);
        overflow-y: auto;
        padding: 1rem;
    }
}

/* Extra small devices (phones in portrait) */
@media (max-width: 480px) {
    /* Very small mobile adjustments */
    .container {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    
    main {
        padding: 0.75rem !important;
    }
    
    .modal {
        margin: 0.25rem !important;
    }
    
    .modal-header,
    .modal-content {
        padding: 0.75rem !important;
    }
    
    /* Smaller text on very small screens */
    h1 { font-size: 1.5rem !important; }
    h2 { font-size: 1.25rem !important; }
    
    /* Single column layout for very small screens */
    .grid-cols-2 {
        grid-template-columns: 1fr !important;
    }
    
    /* Stack everything vertically */
    .flex {
        flex-direction: column !important;
    }
    
    .space-x-2 > * + *,
    .space-x-3 > * + *,
    .space-x-4 > * + * {
        margin-left: 0 !important;
        margin-top: 0.5rem !important;
    }
}

/* Landscape orientation on mobile */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .modal {
        max-height: 95vh !important;
        margin: 0.25rem !important;
    }
    
    .modal-content {
        max-height: calc(95vh - 6rem) !important;
        overflow-y: auto !important;
    }
    
    /* Compact header in landscape */
    header {
        padding: 0.5rem 0 !important;
    }
    
    .hero-featured {
        padding: 1rem !important;
    }
}

/* iOS Safari specific fixes */
@supports (-webkit-touch-callout: none) {
    /* Fix for iOS viewport height */
    .min-h-screen {
        min-height: -webkit-fill-available;
    }
    
    /* Fix for iOS input zoom */
    input, select, textarea {
        font-size: 16px !important;
    }
    
    /* Fix for iOS scroll bounce */
    .modal-content {
        -webkit-overflow-scrolling: touch;
    }
}

/* Android specific fixes */
@media screen and (-webkit-min-device-pixel-ratio: 1) {
    /* Fix for Android keyboard overlay */
    .modal-overlay {
        position: fixed !important;
        top: 0 !important;
        bottom: 0 !important;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .category-card,
    .article-card,
    .video-tutorial-card {
        border-width: 0.5px;
    }
}

/* Accessibility improvements for mobile */
@media (max-width: 768px) {
    /* Larger touch targets */
    button,
    .btn,
    .nav-item,
    .category-card,
    .article-card {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Better focus indicators on mobile */
    button:focus,
    .btn:focus,
    input:focus,
    select:focus {
        outline: 3px solid #4f46e5;
        outline-offset: 2px;
    }
    
    /* Improved text contrast for mobile */
    .text-gray-500 {
        color: #6b7280 !important;
    }
    
    .text-gray-400 {
        color: #9ca3af !important;
    }
}

/* Print styles for mobile */
@media print {
    .mobile-hidden-print {
        display: none !important;
    }
    
    .calculator-modal,
    .modal-overlay {
        position: static !important;
        background: white !important;
    }
    
    .modal {
        box-shadow: none !important;
        border: 1px solid #000 !important;
    }
}

/* Dark mode support for mobile */
@media (prefers-color-scheme: dark) and (max-width: 768px) {
    .knowledge-card,
    .article-card,
    .category-card,
    .modal {
        background: #1f2937 !important;
        color: #f9fafb !important;
        border-color: #374151 !important;
    }
    
    .modal-header {
        background: #374151 !important;
        border-bottom-color: #4b5563 !important;
    }
    
    .form-input-mobile,
    .form-select-mobile {
        background: #374151 !important;
        border-color: #4b5563 !important;
        color: #f9fafb !important;
    }
}