/* Flashcard Market - Custom Styles */

/* Layout Styles */
html, body {
    height: 100%;
    margin: 0;
    display: flex;
    flex-direction: column;
}

.container.py-5 {
    flex: 1;
}

body {
    background-color: #f8f9fa;
}

/* Search Section */
.search-section {
    background-color: #fff;
    border-radius: 0.5rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 8px rgba(128, 128, 128, 0.1);
}

/* Flashcard Card Items */
.flashcard-card {
    transition: all 0.3s ease;
    cursor: pointer;
    height: 100%;
    border: 1px solid #e9ecef;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.flashcard-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 12px 24px rgba(0,0,0,0.15);
    border-color: #0d6efd;
}

.flashcard-card .card-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.flashcard-card .card-header {
    background: linear-gradient(135deg, #0d6efd, #0a58ca);
    color: white;
    border-bottom: none;
    padding: 0.75rem 1.5rem;
}

.flashcard-card:hover .card-header {
    background: linear-gradient(135deg, #0a58ca, #084298);
}

/* Import Button Styles */
.import-btn {
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    color: white !important;
    background-color: rgba(255, 255, 255, 0.1) !important;
    font-size: 0.875rem;
    padding: 0.25rem 0.75rem;
    transition: all 0.2s ease;
}

.import-btn:hover {
    background-color: rgba(255, 255, 255, 0.2) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    color: white !important;
    transform: scale(1.05);
}

.import-btn:focus {
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3) !important;
    color: white !important;
}

.import-btn:active {
    background-color: rgba(255, 255, 255, 0.3) !important;
    color: white !important;
    transform: scale(0.98);
}

/* Flashcard Content Styles */
.flashcard-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 0.75rem;
    flex-grow: 0;
}

.flashcard-category {
    display: inline-block;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0;
}

.flashcard-description {
    color: #6c757d;
    margin-bottom: 1rem;
    line-height: 1.5;
    flex-grow: 1;
}

.flashcard-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid #e9ecef;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.flashcard-stats span {
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.flashcard-card:hover .flashcard-stats {
    color: #495057;
}

.flashcard-card:hover .flashcard-title {
    color: #0d6efd;
}

/* Loading and No Results States */
.loading-spinner {
    display: none;
    text-align: center;
    padding: 2rem;
}

.no-results {
    display: none;
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

/* Filter Chips */
.filter-chip {
    display: inline-block;
    background-color: #e9ecef;
    color: #495057;
    padding: 0.375rem 0.75rem;
    margin: 0.25rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.filter-chip:hover {
    background-color: #dee2e6;
}

.filter-chip.active {
    background-color: #0d6efd;
    color: white;
}

/* Enhanced Modal Styles */
.modal-header {
    border-bottom: 1px solid #dee2e6;
}

.modal-footer {
    border-top: 1px solid #dee2e6;
}

/* Import Modal */
#importModal .modal-body {
    padding: 1.5rem;
}

#importModal .alert-info {
    background-color: #e7f3ff;
    border-color: #b8daff;
    color: #004085;
}

#importModal .alert-info ul {
    padding-left: 1.2rem;
}

#importModal .alert-info li {
    margin-bottom: 0.25rem;
}

/* Success Modal */
#importSuccessModal .modal-body {
    padding: 2rem;
}

#importSuccessModal .text-success {
    color: #198754 !important;
}

#importSuccessModal .bg-success {
    background-color: #198754 !important;
}

#importSuccessModal .btn-close-white {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Warning Modal */
#ownDeckErrorModal .text-warning {
    color: #f57c00 !important;
}

#ownDeckErrorModal .modal-body {
    padding: 2rem;
}

#ownDeckErrorModal .bg-warning {
    background-color: #ffc107 !important;
}

/* Duplicate Import Info Modal */
#duplicateImportErrorModal .text-info {
    color: #0dcaf0 !important;
}

#duplicateImportErrorModal .modal-body {
    padding: 2rem;
}

#duplicateImportErrorModal .bg-info {
    background-color: #0dcaf0 !important;
}

#duplicateImportErrorModal .btn-close-white {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* Modal Icons */
.modal .display-4 {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Button Loading States */
.import-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.import-btn:disabled:hover {
    transform: none !important;
}

#confirmImportBtn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

#confirmImportBtn:disabled:hover {
    transform: none !important;
}

/* Spinner Animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Success Icon Animation */
@keyframes checkmark {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    50% {
        transform: scale(1.2);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

#importSuccessModal .bi-check-circle-fill {
    animation: checkmark 0.6s ease-out;
}

/* Warning Icon Animation */
@keyframes warning-shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

#ownDeckErrorModal .bi-exclamation-triangle-fill {
    animation: warning-shake 0.6s ease-out;
}

/* Modal Transition Effects */
.modal.fade .modal-dialog {
    transition: transform 0.3s ease-out;
    transform: translate(0, -50px);
}

.modal.show .modal-dialog {
    transform: none;
}

/* Enhanced Button Styles */
.btn-outline-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.3);
}

.btn-primary {
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(13, 110, 253, 0.4);
}

/* Responsive Design */
@media (max-width: 768px) {
    .search-section {
        padding: 1.5rem;
    }

    .flashcard-card .card-body {
        padding: 1rem;
    }

    .flashcard-card .card-header {
        padding: 0.5rem 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .import-btn {
        font-size: 0.8rem;
        padding: 0.2rem 0.5rem;
    }

    .flashcard-stats {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.2rem;
    }

    .flashcard-stats span {
        font-size: 0.75rem;
    }

    .d-flex.justify-content-between.align-items-center {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .btn-group {
        width: 100%;
    }

    .btn-group .btn {
        flex: 1;
    }

    .flashcard-card:hover {
        transform: translateY(-4px) scale(1.01);
    }

    /* Modal adjustments for mobile */
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal .display-4 {
        font-size: 2.5rem;
    }
}

@media (max-width: 576px) {
    .display-4 {
        font-size: 2rem;
    }

    .input-group-lg .form-control,
    .form-select-lg {
        font-size: 1rem;
    }

    .filter-chip {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }

    .flashcard-card:hover {
        transform: translateY(-2px);
    }

    .flashcard-card .card-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .import-btn {
        font-size: 0.75rem;
        padding: 0.15rem 0.4rem;
    }

    /* Smaller modals on very small screens */
    .modal .display-4 {
        font-size: 2rem;
    }

    .modal-header h5 {
        font-size: 1.1rem;
    }
}

/* Animation for smooth transitions */
.flashcard-card,
.flashcard-card .card-header,
.flashcard-title,
.flashcard-stats,
.filter-chip,
.btn,
.import-btn {
    transition: all 0.3s ease;
}

/* Additional hover effects */
.flashcard-card:hover .flashcard-description {
    color: #495057;
}

.flashcard-card:hover .card-body {
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
}

/* Glow effect on hover */
.flashcard-card:hover {
    box-shadow: 0 12px 24px rgba(13, 110, 253, 0.15), 0 0 20px rgba(13, 110, 253, 0.1);
}

/* Icon animations on hover */
.flashcard-card:hover .bi {
    transform: scale(1.1);
    transition: transform 0.2s ease;
}

.import-btn .bi {
    transition: transform 0.2s ease;
}

.import-btn:hover .bi {
    transform: scale(1.2);
}

/* Focus states for accessibility */
.flashcard-card:focus {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.25);
}

.filter-chip:focus {
    outline: 2px solid #0d6efd;
    outline-offset: 2px;
}

.btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Custom scrollbar for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Progress indicators */
.progress-bar {
    transition: width 0.6s ease;
}

/* Toast notifications (if you want to add them later) */
.toast {
    border-radius: 0.5rem;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

/* Loading skeleton animations (for future enhancements) */
@keyframes skeleton-loading {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s infinite;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .flashcard-card {
        border: 2px solid #000;
    }

    .flashcard-card:hover {
        border-color: #0d6efd;
        border-width: 3px;
    }

    .import-btn {
        border: 2px solid white !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .flashcard-card,
    .import-btn,
    .filter-chip,
    .btn,
    .modal .bi-check-circle-fill,
    .modal .bi-exclamation-triangle-fill {
        transition: none;
        animation: none;
    }

    .flashcard-card:hover {
        transform: none;
    }
}

/* Dark mode support (if you want to add it later) */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #ffffff;
    }

    .search-section {
        background-color: #2d2d2d;
        color: #ffffff;
    }

    .flashcard-card {
        background-color: #2d2d2d;
        border-color: #404040;
        color: #ffffff;
    }

    .modal-content {
        background-color: #2d2d2d;
        color: #ffffff;
    }
}