/* css/hockey-flashcards.css */
/* Includes Toggle Switch Styling */

/* --- Base Wrapper --- */
.hockey-flashcards-wrapper {
    padding: 20px;
    margin: 25px 0;
    border: 1px solid #e0e0e0;
    border-radius: 5px;
    background-color: #f9f9f9;
    color: #333;
    position: relative;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    font-family: sans-serif;
}

/* --- Title --- */
.hockey-flashcards-wrapper .flashcard-title {
    color: #333;
    margin-top: 0;
    margin-bottom: 0px; /* Keep title close to options */
    text-align: center;
    font-size: 1.6em;
    text-shadow: none;
}

/* --- Options Container (for side-by-side toggles) --- */
.hockey-flashcards-wrapper .flashcard-options-container {
    display: flex;
    justify-content: center; /* Or space-around, space-between */
    align-items: center;
    gap: 20px; /* Space between the two toggle groups */
    margin-top: 15px; /* Space below title (if any) or from top of wrapper */
    margin-bottom: 20px; /* Space before flashcard container */
    width: auto; /* Allow it to size based on content, or 100% if needed */
    flex-wrap: wrap; /* Allow wrapping on smaller screens if necessary */
}

/* --- Common Toggle Group Styling --- */
.hockey-flashcards-wrapper .options-toggle-group {
    background-color: #f0f0f0;
    padding: 8px 15px;
    border-radius: 20px;
    border: 1px solid #e0e0e0;
    box-shadow: none;
    display: inline-flex; /* Changed from inline-flex on the old .start-options-toggle to allow flex item behavior */
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.9em;
    color: #555;
}

/* Legend styling (applies to both "Start With:" and "Order:") */
.hockey-flashcards-wrapper .options-toggle-group .start-options-legend,
.hockey-flashcards-wrapper .options-toggle-group .sort-options-legend {
    font-weight: bold;
    padding: 0;
    margin: 0;
    margin-right: 5px;
}

/* General toggle label styling */
.hockey-flashcards-wrapper .options-toggle-group .toggle-label {
    color: #666;
    cursor: default;
    transition: color 0.3s ease, font-weight 0.3s ease;
    font-weight: normal;
}

/* Highlight active state for "Start With" toggle */
.hockey-flashcards-wrapper .options-toggle-group#start-side-options .hockey-toggle-switch input:not(:checked) ~ .toggle-label-word,
.hockey-flashcards-wrapper .options-toggle-group#start-side-options .hockey-toggle-switch input:checked ~ .toggle-label-definition {
     color: #333;
     font-weight: bold;
}
/* Ensure non-active labels for "Start With" toggle are default */
.hockey-flashcards-wrapper .options-toggle-group#start-side-options .hockey-toggle-switch input:checked ~ .toggle-label-word,
.hockey-flashcards-wrapper .options-toggle-group#start-side-options .hockey-toggle-switch input:not(:checked) ~ .toggle-label-definition {
     color: #666;
     font-weight: normal;
}

/* Highlight active state for "Order" toggle */
.hockey-flashcards-wrapper .options-toggle-group#sort-order-options .hockey-toggle-switch input:not(:checked) ~ .toggle-label-alphabetical,
.hockey-flashcards-wrapper .options-toggle-group#sort-order-options .hockey-toggle-switch input:checked ~ .toggle-label-random {
     color: #333;
     font-weight: bold;
}
/* Ensure non-active labels for "Order" toggle are default */
.hockey-flashcards-wrapper .options-toggle-group#sort-order-options .hockey-toggle-switch input:checked ~ .toggle-label-alphabetical,
.hockey-flashcards-wrapper .options-toggle-group#sort-order-options .hockey-toggle-switch input:not(:checked) ~ .toggle-label-random {
     color: #666;
     font-weight: normal;
}

/* The switch container (applies to both toggles within an options-toggle-group) */
.hockey-flashcards-wrapper .options-toggle-group .hockey-toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
  vertical-align: middle;
}

/* Hide default HTML checkbox */
.hockey-flashcards-wrapper .options-toggle-group .hockey-toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

/* The slider track */
.hockey-flashcards-wrapper .options-toggle-group .hockey-toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #800080; /* Off state */
  transition: .4s;
  border-radius: 22px;
}

/* The slider thumb */
.hockey-flashcards-wrapper .options-toggle-group .hockey-toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Checked state styles */
.hockey-flashcards-wrapper .options-toggle-group .hockey-toggle-switch input:checked + .hockey-toggle-slider {
  background-color: #800080; /* Your Site purple for ON state */
}

/* Optional: Focus style for accessibility */
.hockey-flashcards-wrapper .options-toggle-group .hockey-toggle-switch input:focus + .hockey-toggle-slider {
  box-shadow: 0 0 2px #800080;
}

/* Thumb movement */
.hockey-flashcards-wrapper .options-toggle-group .hockey-toggle-switch input:checked + .hockey-toggle-slider:before {
  transform: translateX(22px);
}
/* --- End Toggle Switch Styles --- */


/* --- Card Container / Viewport --- */
.hockey-flashcards-wrapper #flashcard-container {
    width: 100%;
    max-width: 500px;
    /* margin-bottom: 25px; Removed - Spacing now handled by .start-options-toggle margin-bottom */
    margin-left: auto;
    margin-right: auto;
}

.hockey-flashcards-wrapper #card-viewport {
    width: 100%;
    height: 300px;
    overflow: hidden;
    position: relative;
    border-radius: 15px;
    background-color: #fff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1), 0 5px 10px rgba(0, 0, 0, 0.08);
    border: none;
}

/* --- Card Slider --- */
.hockey-flashcards-wrapper #card-slider {
    display: flex;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    transition: transform 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* --- Card Scene (Padded Container for Card) --- */
.hockey-flashcards-wrapper .card-scene {
    width: 100%;
    height: 100%;
    perspective: 1200px;
    flex-shrink: 0;
    padding: 20px;
    box-sizing: border-box;
}

/* --- The Card Element --- */
.hockey-flashcards-wrapper .card {
    width: 100%;
    height: 100%;
    position: relative;
    /* cursor: pointer; */ /* REMOVED - Overlay handles cursor */
    transform-style: preserve-3d;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    user-select: none;
    -webkit-user-select: none;
    -ms-user-select: none;
    /* Default state: Front facing */
    transform: rotateY(0deg) rotateX(0deg);
    /* NO base transition/animation for transform */
}

/* Logical state class - JS sets transform directly */
.hockey-flashcards-wrapper .card.is-flipped {
    /* No transform needed here */
}

/* State during dragging */
.hockey-flashcards-wrapper .card.is-dragging {
    transition: none !important; /* Disable CSS transitions/animations */
    cursor: grabbing;
}

/* State for snap-back animation */
.hockey-flashcards-wrapper .card.is-snapping-back {
    /* Apply transition only when snapping back */
    transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); /* Matches SNAP_DURATION */
}

/* --- Card Faces --- */
.hockey-flashcards-wrapper .card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    text-align: center;
    overflow-wrap: break-word;
    box-sizing: border-box;
    /* pointer-events: none; */ /* REMOVED */
}

/* Styling for the "Word" content, regardless of face */
.hockey-flashcards-wrapper .card-face.content-word {
    background: #800080; /* Your Site purple */
    color: white;
    font-size: 1.8em;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
}

/* Styling for the "Definition" content, regardless of face */
.hockey-flashcards-wrapper .card-face.content-definition {
    background: #f2e6f2; /* Your Site light background */
    color: #333;
    font-size: 1em;
    line-height: 1.5;
}

/* Positioning for the actual front face */
.hockey-flashcards-wrapper .card-face--front {
    /* transform: rotateY(0deg); is implicit */
    /* Styles related to content (bg, color, font) moved to .content-word / .content-definition */
}

/* Positioning for the actual back face */
.hockey-flashcards-wrapper .card-face--back {
    transform: rotateY(180deg); /* This is crucial for the flip */
    /* Styles related to content (bg, color, font) moved to .content-word / .content-definition */
}

.card-face.has-image {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: stretch;
}

.flashcard-image-container {
    width: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none; /* Prevent image container from being dragged */
}

.flashcard-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    pointer-events: none; /* Prevent image from being dragged */
}

.flashcard-definition-text,
.flashcard-term-text {
    width: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    box-sizing: border-box;
    text-align: center;
}


.flashcard-audio-icon {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10; /* Ensure it's on top of everything */
    pointer-events: auto; /* Explicitly enable pointer events */
    background-color: rgba(255, 255, 255, 0.7);
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    -webkit-backface-visibility: hidden; /* Safari */
    backface-visibility: hidden;
}

.flashcard-audio-icon img {
    width: 18px; /* Adjust size of the SVG inside the button */
    height: 18px;
    display: block;
}

.flashcard-audio-icon:hover {
    background-color: white;
    border-color: #800080;
    transform: translateX(-50%) scale(1.1);
}

/* --- Navigation --- */
.hockey-flashcards-wrapper #navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 500px;
    user-select: none;
    margin-left: auto;
    margin-right: auto;
    margin-top: 25px; /* Ensure space above navigation */
}

.hockey-flashcards-wrapper #navigation button {
    padding: 10px 25px !important;
    background-color: #800080 !important;
    color: white !important;
    border: none !important;
    cursor: pointer !important;
    font-size: 0.95em !important;
    border-radius: 25px !important; /* Rounded like toggle container */
    font-weight: bold;
    transition: background-color 0.2s ease, opacity 0.2s ease, transform 0.1s ease, box-shadow 0.15s ease;
    box-shadow: 0 3px 5px rgba(0, 0, 0, 0.1);
    line-height: normal;
}
    .hockey-flashcards-wrapper #navigation button:hover:not(:disabled) {
        background-color: #6a0dad !important; /* Darker purple on hover */
        transform: translateY(-2px);
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    }
    .hockey-flashcards-wrapper #navigation button:active:not(:disabled) {
        transform: translateY(0px);
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    .hockey-flashcards-wrapper #navigation button:disabled {
        background-color: #800080 !important; /* Keep purple but faded */
        opacity: 0.6 !important;
        cursor: not-allowed !important;
        transform: none;
        box-shadow: none;
    }

/* Card counter */
.hockey-flashcards-wrapper #card-counter {
    font-size: 1em;
    font-weight: 600;
    color: #555;
    margin: 0 15px;
}

/* --- Error/Notice Messages (Added from PHP, ensure styling) --- */
.hockey-flashcards-error,
.hockey-flashcards-notice {
    max-width: 500px;
    margin: 20px auto;
}

/* --- Mobile Styles --- */
@media (max-width: 768px) {
    .hockey-flashcards-wrapper #card-viewport {
        height: 350px; /* Increased height for mobile */
    }

    .card-face.has-image {
        flex-direction: row; /* Word on left, image on right */
    }

    .card-face.has-image .flashcard-image-container {
        width: 50%;
        height: 100%;
    }

    .card-face.has-image .flashcard-definition-text,
    .card-face.has-image .flashcard-term-text {
        width: 50%;
        height: 100%;
        text-align: center;
    }

    .flashcard-image {
        opacity: 1; /* Ensure image is not transparent */
    }

    .card-face.content-word.has-image .flashcard-image {
        opacity: 0.25; /* Make image slightly transparent on the word face */
    }

    .hockey-flashcards-wrapper .card-face.content-word .flashcard-term-text,
    .hockey-flashcards-wrapper .card-face.content-definition .flashcard-term-text {
        font-size: 0.7em !important; /* Reduce font size for words on mobile */
    }
}
