/* Flashcards JuriSensus v13.1.0 - Frontend Styles */

.flashcards-main-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.flashcards-header {
    display: flex;
    flex-direction: column;
}

.flashcards-header-item {
    width: 100%;
}

.flashcards-header-text {
    display: block;
    line-height: 1.6;
}

.flashcards-controls {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.flashcards-options-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.flashcards-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.flashcard-tab {
    padding: 12px 24px;
    border: 2px solid;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    outline: none;
}

.flashcard-tab .tab-count {
    font-weight: 500;
    opacity: 0.85;
}

.flashcards-order-selector {
    display: flex;
    gap: 10px;
    align-items: center;
}

.order-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    position: relative;
    padding: 4px 8px;
    border-radius: 8px;
}

.order-option input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #2074FF;
    border-radius: 50%;
    outline: none;
    cursor: pointer;
    position: relative;
    background-color: #ffffff;
}

.order-option input[type="radio"]:checked {
    border-color: #2074FF;
    background-color: #2074FF;
}

.order-option input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #ffffff;
}

.order-label {
    user-select: none;
    font-weight: 600;
}

/* Mode Selector Styles */
.flashcards-mode-selector {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mode-label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    user-select: none;
}

.mode-label-left {
    color: #2074FF;
}

.mode-label-right {
    color: #666;
}

.mode-switcher {
    position: relative;
    display: inline-block;
    width: 56px;
    height: 28px;
}

.mode-switcher input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
}

.mode-switcher-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #2074FF;
    transition: 0.3s;
    border-radius: 28px;
}

.mode-switcher-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.mode-switcher input:checked + .mode-switcher-slider {
    background-color: #2955BB;
}

.mode-switcher input:checked + .mode-switcher-slider:before {
    transform: translateX(28px);
}

.mode-switcher input:checked ~ .mode-label-left {
    color: #666;
}

.mode-switcher input:checked ~ .mode-label-right {
    color: #2074FF;
}

.flashcards-slider-container {
    width: 100%;
    position: relative;
}

.flashcard-wrapper {
    display: none;
    width: 100%;
    perspective: 1000px;
}

.flashcard-wrapper.active {
    display: block;
}

.flashcard-wrapper.slide-out-left {
    animation: slideOutLeft 0.4s ease-in-out forwards;
}

.flashcard-wrapper.slide-in-right {
    animation: slideInRight 0.4s ease-in-out forwards;
}

@keyframes slideOutLeft {
    0% {
        transform: translateX(0);
        opacity: 1;
    }
    100% {
        transform: translateX(-100%);
        opacity: 0;
    }
}

@keyframes slideInRight {
    0% {
        transform: translateX(100%);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

.flashcard {
    position: relative;
    width: 100%;
    min-height: 400px;
    cursor: pointer;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.flashcard.flipped {
    transform: rotateY(180deg);
}

.flashcard-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
}

.flashcard-front,
.flashcard-back {
    position: relative;
    width: 100%;
    min-height: 400px;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.flashcard-front {
    transform: rotateY(0deg);
    justify-content: center;
}

.flashcard-back {
    justify-content: flex-start;
    align-items: center;
}

.flashcard-back {
    position: absolute;
    top: 0;
    left: 0;
    transform: rotateY(180deg);
}

.flashcard-front .flashcard-content {
    display: none;
}

.flashcard-title {
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
    width: 100%;
}

.flashcard-back .flashcard-title {
    align-self: flex-start;
}

.flashcard-content {
    width: 100%;
    line-height: 1.6;
    flex-grow: 1;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.flashcard-content p {
    margin: 0 0 15px 0;
    width: 100%;
}

.flashcard-content p:last-child {
    margin-bottom: 0;
}

.flashcard-content ul,
.flashcard-content ol {
    margin: 10px 0;
    padding-left: 20px;
    text-align: left;
    display: inline-block;
}

.flashcard-content li {
    margin-bottom: 8px;
}

.flashcard-reveal {
    margin-top: 20px;
    padding: 14px 35px;
    color: #FFFFFF;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    align-self: center;
}

.flashcard-back-actions {
    width: 100%;
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.flashcard-back-icon {
    padding: 12px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.flashcard-memorization-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex: 1;
}

.flashcard-memorize-btn,
.flashcard-help-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    border: none;
    color: #FFFFFF;
    font-weight: 600;
    cursor: pointer;
    flex: 1;
    max-width: 220px;
    justify-content: center;
}

.flashcard-memorize-btn svg,
.flashcard-help-btn svg {
    flex-shrink: 0;
}

.flashcard-memorize-btn span,
.flashcard-help-btn span {
    font-weight: 600;
}

/* Study Mode Container */
.flashcards-study-mode {
    width: 100%;
}

.flashcards-slider-wrapper {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
}

.flashcards-slider-inner {
    flex: 1;
    min-height: 400px;
    position: relative;
}

.flashcards-slider-inner .flashcard-wrapper {
    width: 100%;
    height: 100%;
}

.flashcard-nav-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    color: #FFFFFF;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    outline: none;
}

.flashcard-nav-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.flashcard-nav-btn svg {
    width: 24px;
    height: 24px;
}

.flashcard-counter {
    font-weight: 600;
    text-align: center;
}

/* List Mode Styles */
.flashcards-list-mode {
    width: 100%;
    padding: 20px 0;
}

.flashcards-list-header {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
}

.flashcards-download-docx {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background-color: #2074FF;
    color: #FFFFFF;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
}

.flashcards-download-docx:hover {
    background-color: #2955BB;
}

.flashcards-download-docx svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.flashcards-download-docx span {
    font-weight: 600;
}

.flashcards-list-container {
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
}

.flashcard-list-item {
    border-radius: 12px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.flashcard-list-item:last-child {
    margin-bottom: 0;
}

.flashcard-list-question {
    margin-bottom: 15px;
}

.flashcard-list-label {
    font-weight: 700;
    color: #2074FF;
    margin-bottom: 8px;
    display: block;
}

.flashcard-list-text {
    color: #333;
    line-height: 1.6;
    margin: 0;
}

.flashcard-list-separator {
    height: 1px;
    background: linear-gradient(to right, rgba(32, 116, 255, 0.2), rgba(32, 116, 255, 0.05));
    margin: 15px 0;
}

.flashcard-list-answer {
    margin-top: 15px;
}

.no-flashcards-message {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    font-size: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.no-flashcards-message img {
    margin-bottom: 20px;
}

.no-flashcards-message p {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
}

.flashcard-content img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 15px 0;
}

.flashcard-content a {
    color: inherit;
    text-decoration: underline;
}

.flashcard-content blockquote {
    margin: 20px 0;
    padding: 15px 20px;
    border-left: 4px solid currentColor;
    opacity: 0.9;
}

.flashcard-content code {
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.flashcard-content pre {
    padding: 15px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 15px 0;
}

.flashcard-content strong {
    font-weight: 700;
}

.flashcard-content em {
    font-style: italic;
}

/* Help Modal Styles */

.flashcard-help-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.flashcard-help-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.flashcard-help-content {
    position: relative;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.flashcard-help-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.flashcard-help-close:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.flashcard-help-close svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.flashcard-help-title {
    margin: 0 0 25px 0;
    font-weight: 700;
    text-align: center;
}

.flashcard-help-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.flashcard-help-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.flashcard-help-label {
    font-weight: 600;
}

.flashcard-help-input,
.flashcard-help-textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
    outline: none;
}

.flashcard-help-input:focus,
.flashcard-help-textarea:focus {
    outline: none;
}

.flashcard-help-input[readonly] {
    background-color: #f5f5f5;
    cursor: not-allowed;
}

.flashcard-help-textarea {
    resize: vertical;
    min-height: 120px;
}

.flashcard-help-submit {
    padding: 14px 30px;
    border: none;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
    align-self: center;
    min-width: 200px;
}

.flashcard-help-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.flashcard-help-success {
    text-align: center;
    padding: 20px;
}

.flashcard-help-success-icon {
    display: block;
    margin: 0 auto 20px;
}

.flashcard-help-success-message {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    line-height: 1.6;
}

/* Feedback Images */

.feedback-image {
    display: block;
    margin: 0 auto 20px;
    max-width: 100%;
    height: auto;
}

.congratulations-image {
    width: 50%;
    max-width: 300px;
}

.no-cards-image {
    width: 50%;
    max-width: 300px;
}

/* Responsive Styles */

@media (max-width: 768px) {
    .flashcards-main-container {
        padding: 15px 10px;
    }
    
    .flashcards-options-wrapper {
        flex-direction: column;
        gap: 15px;
        width: 100%;
    }
    
    .flashcards-tabs {
        width: 100%;
        justify-content: center;
    }
    
    .flashcard-tab {
        padding: 10px 16px;
        font-size: 13px;
        flex: 1;
        text-align: center;
    }
    
    .flashcards-order-selector {
        width: 100%;
        justify-content: center;
    }
    
    .flashcards-mode-selector {
        width: 100%;
        justify-content: center;
    }
    
    .order-option {
        font-size: 13px;
    }
    
    .mode-label {
        font-size: 13px;
    }
    
    .flashcard,
    .flashcard-front,
    .flashcard-back {
        min-height: 350px;
    }
    
    .flashcards-slider-inner {
        min-height: 350px;
    }
    
    .flashcards-slider-wrapper {
        gap: 10px;
    }
    
    .flashcard-back-actions {
        flex-wrap: wrap;
    }
    
    .flashcard-memorization-buttons {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }
    
    .flashcard-memorize-btn,
    .flashcard-help-btn {
        max-width: 100%;
    }
    
    .flashcard-nav-btn {
        width: 44px;
        height: 44px;
        flex-shrink: 0;
    }
    
    .flashcard-help-content {
        width: 95%;
    }
    
    .congratulations-image,
    .no-cards-image {
        width: 70%;
    }
    
}

@media (max-width: 480px) {
    .flashcard,
    .flashcard-front,
    .flashcard-back {
        min-height: 300px;
    }
    
    .flashcards-slider-inner {
        min-height: 300px;
    }
    
    .flashcards-slider-wrapper {
        gap: 8px;
    }
    
    .flashcard-nav-btn {
        width: 40px;
        height: 40px;
    }
    
    .flashcard-reveal {
        padding: 12px 28px;
        font-size: 14px;
    }
    
    .flashcard-memorize-btn,
    .flashcard-help-btn {
        padding: 12px 20px;
        font-size: 14px;
    }
    
    .flashcard-memorize-btn span,
    .flashcard-help-btn span {
        font-size: 14px;
    }
    
    .flashcards-tabs {
        flex-direction: column;
        width: 100%;
    }
    
    .flashcard-tab {
        width: 100%;
    }
    
    .flashcard-help-submit {
        width: 100%;
        min-width: auto;
    }
    
}
