@charset "UTF-8";

/* Base Styles */
:root {
    /* Light mode colors */
    --primary-color: #000;
    --secondary-color: #4c5257;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --border-color: #dee2e6;
    
    --bg-color: #ffffff;
    --content-bg-color: #f8f9fa;
    --alt-content-bg-color: #f0f0f0;
    --font-color: #333333;
    --accent-color: #007bff;
    
    --card-bg: var(--bg-color); /* Set card background to match bg-color */
    --card-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    
    --border-radius: 8px;
    --box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

/* Dark mode colors */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-color: #fff;
        --secondary-color: #959da5;
        --light-color: #212529;
        --dark-color: #f8f9fa;
        --border-color: #495057;
        
        --bg-color: #121212;
        --content-bg-color: #1e1e1e;
        --alt-content-bg-color: #2d2d2d;
        --font-color: #e0e0e0;
        --accent-color: #0d6efd;
        
        --card-bg: var(--bg-color); /* Set card background to match bg-color */
        --card-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
        
        --box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    }
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--font-color);
    padding-top: 20px; /* Space for fixed header */
}

/* Page Header */
.page-header {
    color: var(--font-color);
    padding: 10px 0;
    text-align: center;
    margin-bottom: 10px;
}

.page-header .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.page-header h1 {
    font-size: 28px;
    margin-bottom: 10px;
    font-weight: 700;
}

.page-header p {
    font-size: 16px;
    max-width: 700px;
    margin: 0 auto;
    opacity: 0.9;
}

/* Main Container */
.main-container {
    max-width: 1200px;
    min-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.flashcard-container {
    background: var(--content-bg-color);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 30px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

/* Mode Tabs */
.mode-tabs {
    display: flex;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
}

.mode-tab {
    padding: 12px 24px;
    background: none;
    border: none;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--secondary-color);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    margin-right: 10px;
}

.mode-tab.active {
    color: var(--font-color);
}

.mode-tab::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background-color: var(--font-color);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.mode-tab.active::after {
    transform: scaleX(1);
}

.mode-tab:hover {
    color: var(--font-color);
}

.mode-panel {
    display: none;
}

.mode-panel.active {
    display: block;
}

/* Create Mode */
.deck-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 20px;
}

.deck-name-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.deck-name-container label {
    font-weight: 600;
    color: var(--font-color);
}

.deck-name-container input {
    padding: 8px 12px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--font-color);
    font-size: 1.1rem;
    min-width: 250px;
}

.deck-stats {
    font-size: 0.95rem;
    color: var(--secondary-color);
    font-weight: 500;
}

/* Card Creator */
.card-creator {
    background: var(--alt-content-bg-color);
    border-radius: var(--border-radius);
    padding: 25px;
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

.card-input-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.card-input-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.card-input-section label {
    font-weight: 600;
    color: var(--font-color);
}

.card-input-section textarea {
    height: 200px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--bg-color); /* Changed from --card-bg to --bg-color */
    color: var(--font-color); /* Ensuring proper font color */
    padding: 15px;
    resize: none;
    font-size: 1.2rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.card-input-section textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

.card-input-section.front textarea {
    border-left: 4px solid var(--accent-color);
}

.card-input-section.back textarea {
    border-left: 4px solid var(--success-color);
}

/* Update the focus styles for answer textarea */
.card-input-section.back textarea:focus {
    outline: none;
    border-color: var(--success-color); /* Green border for answer textarea */
}

/* Keep the existing focus style for front textarea */
.card-input-section.front textarea:focus {
    outline: none;
    border-color: var(--accent-color); /* Blue border for question textarea */
}

/* Replace the existing card-preview with side-by-side layout */
.card-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 20px;
}

.flashcard-preview {
    width: 100%;
    max-width: 500px;
    height: 250px;
    position: relative;
    perspective: 1000px;
    margin-bottom: 15px;
}

.card-side {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    transition: transform 0.6s ease;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 30px;
    background-color: var(--bg-color);
    /* Remove the opacity and visibility rules that prevent showing */
}

.card-side.active {
    transform: rotateY(0deg);
    opacity: 1;
    pointer-events: auto;
}

.card-side.front {
    background-color: var(--bg-color); /* Changed from --card-bg to --bg-color */
    border: 2px solid var(--accent-color);
}

.card-side.back {
    background-color: var(--bg-color); /* Changed from --card-bg to --bg-color */
    border: 2px solid var(--success-color);
}

.card-back-preview {
    color: var(--secondary-color);
    font-size: 0.8rem;
}

.card-header {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 20px;
    text-decoration: underline;
    color: var(--font-color);
    opacity: 0.8;
}

/* Center all text content in the card */
.study-card .card-content {
    font-size: 1.3rem;
    text-align: center;
    width: 100%;
    overflow-wrap: break-word;
    color: var(--font-color);
    margin-top: 10px;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-side textarea {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
    resize: none;
    font-size: 1.2rem;
    color: var(--font-color);
    padding: 10px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.card-side textarea:focus {
    outline: none;
}

.card-flip-control {
    display: flex;
    justify-content: center;
}

.flip-btn {
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.flip-btn:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

.card-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.primary-btn {
    background-color: var(--success-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    font-size: 1rem;
}

.primary-btn:hover:not(:disabled) {
    background-color: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.secondary-btn {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    font-size: 1rem;
}

.secondary-btn:hover:not(:disabled) {
    background-color: #3d4246;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.danger-btn {
    background-color: var(--danger-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    font-size: 1rem;
}

.danger-btn:hover:not(:disabled) {
    background-color: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

button:disabled {
    opacity: 0.6;
    border: 1px solid #AAA;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Deck Manager */
.deck-manager h3 {
    font-size: 1.4rem;
    margin-bottom: 15px;
    color: var(--font-color);
}

.card-list {
    background-color: var(--alt-content-bg-color);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 25px;
}

.empty-deck-message {
    padding: 40px;
    text-align: center;
    color: var(--secondary-color);
}

.empty-deck-message .hint {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 10px;
}

.card-list-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

/* Rearranged order of elements */
.delete-btn-container {
    margin-right: 10px; /* Space between delete button and card index */
}

.card-content {
    flex: 1;
    padding: 0 15px;
    overflow: hidden;
}

/* Style for include/exclude toggle switch */
.card-toggle-container {
    display: flex;
    align-items: center;
}

/* Toggle switch styling */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    margin-left: 10px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--success-color);
}

input:focus + .toggle-slider {
    box-shadow: 0 0 1px var(--success-color);
}

input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

.toggle-label {
    margin-left: 8px;
    font-size: 0.85rem;
    color: var(--secondary-color);
}

/* Update the button styling for delete */
.delete-btn {
    border: none;
    padding: 5px 10px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.85rem;
    font-weight: 500;
    background-color: var(--danger-color);
    color: white;
}

.delete-btn:hover {
    background-color: #c82333;
}

.deck-actions {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.action-group {
    display: flex;
    gap: 10px;
}

/* Study Mode */
.study-header {
    margin-bottom: 30px;
}

.study-header h3 {
    font-size: 1.4rem;
    margin-bottom: 15px;
    color: var(--font-color);
}

.study-progress {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-text {
    font-size: 0.95rem;
    color: var(--secondary-color);
    font-weight: 500;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background-color: var(--border-color);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: var(--success-color);
    border-radius: 10px;
    transition: width 0.3s ease;
}

/* Study Card Container Layout Adjustments */
.study-card-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 40px; /* Increased margin to provide more space */
    min-height: 400px; /* Ensure enough height for the study area */
    position: relative;
}

/* Center the study card properly */
.study-card {
    width: 100%;
    max-width: 600px;
    height: 300px;
    position: relative;
    perspective: 1000px;
    margin: 0 auto 60px; /* Added more bottom margin to create space for buttons */
}

/* Position the study controls below the card with proper spacing */
.study-controls {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 40px; /* Increased top margin to push controls down */
    width: 100%;
    max-width: 600px;
    position: relative;
    z-index: 5; /* Ensure controls stay above card if there's any overlap */
    padding-top: 20px; /* Add padding to create more separation */
}

/* Style navigation buttons consistently */
.nav-btn, .flip-study-btn {
    padding: 12px 24px; /* Larger buttons for easier clicking */
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 600;
    font-size: 1rem;
    min-width: 130px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15); /* Add subtle shadow for depth */
}

/* Enhanced button hover states */
.nav-btn:hover:not(:disabled), .flip-study-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.flip-study-btn {
    background-color: var(--accent-color);
    color: white;
}

/* Ensure cards aren't overlapping buttons */
.study-card .card-side {
    position: absolute;
    width: calc(100% - 60px); /* Adjust width to fit within the card container */
    height: 100%;
    backface-visibility: hidden;
    transition: transform 0.6s ease;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 30px;
    background-color: var(--bg-color);
    /* Remove the opacity and visibility rules that prevent showing */
}

/* Hide the confidence buttons section */
.confidence-buttons {
    display: none;
}

.study-session-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    margin-bottom: 30px;
}

/* Simplified study completion screen */
.study-complete {
    background-color: var(--alt-content-bg-color);
    border-radius: var(--border-radius);
    padding: 30px;
    text-align: center;
    border: 1px solid var(--border-color);
    max-width: 500px;
    margin: 0 auto;
}

.complete-message h2 {
    font-size: 2rem;
    margin-bottom: 25px;
    color: var(--font-color);
}

/* Simplified stats section with only cards reviewed count */
.study-stats {
    margin-bottom: 30px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.stat-label {
    font-size: 1.1rem;
    color: var(--font-color);
    font-weight: 500;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-color);
}

.complete-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .deck-info {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .deck-name-container {
        width: 100%;
    }
    
    .deck-name-container input {
        flex: 1;
    }
    
    .card-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .deck-actions {
        flex-direction: column;
    }
    
    .action-group {
        width: 100%;
    }
    
    .action-group button {
        flex: 1;
    }
    
    .study-navigation {
        flex-direction: column;
        gap: 15px;
    }
    
    .confidence-buttons {
        width: 100%;
    }
    
    .confidence-btn {
        flex: 1;
    }
    
    .nav-btn {
        width: 100%;
    }
    
    .card-input-container {
        grid-template-columns: 1fr;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--alt-content-bg-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3d4246;
}

/* Card flip animation styles */
.study-card {
    perspective: 1000px;
    transform-style: preserve-3d;
}

.study-card .card-side {
    backface-visibility: hidden;
    transition: transform 0.6s ease;
}

.study-card .card-side.front {
    transform: rotateY(0deg);
}

.study-card .card-side.back {
    transform: rotateY(180deg);
}

/* When card is flipped */
.study-card.flipped .card-side.front {
    transform: rotateY(-180deg);
}

.study-card.flipped .card-side.back {
    transform: rotateY(0deg);
}

/* Add toggle for concealing answers in deck list */
.deck-manager-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.deck-manager-header h3 {
    margin: 0;
    font-size: 1.4rem;
    color: var(--font-color);
}

.conceal-toggle-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.conceal-toggle {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.conceal-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.conceal-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 20px;
}

.conceal-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.conceal-toggle input:checked + .conceal-slider {
    background-color: var(--success-color);
}

.conceal-toggle input:checked + .conceal-slider:before {
    transform: translateX(20px);
}

.conceal-label {
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 500;
}

/* Style for concealed answers */
.card-back-preview.concealed {
    color: transparent;
    border-radius: 4px;
    position: relative;
    min-height: 1em;
}

.card-back-preview.concealed::after {
    content: "Answer hidden";
    position: absolute;
    top: 0;
    left: 0;
    color: var(--secondary-color);
    font-style: italic;
    font-size: 0.75rem;
}