/* Base styles - shared across all themes */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    min-width: 280px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.siderbar-header .header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.sidebar-header .header-top h1 {
    cursor: pointer;
    transition: color 0.2s;
    font-size: 1.5rem;
    color: var(--primary-color);
    margin: 0;
}

.sidebar-header .header-top h1:hover {
    opacity: 0.8;
}

/* Hamburger Menu Button */
.hamburger-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
    font-size: 1.2rem;
    color: var(--text-color);
    line-height: 1;
    width: auto;
    height: auto;
}

.hamburger-btn:hover {
    background: var(--card-hover);
}

.hamburger-btn.active {
    background: var(--card-hover);
}

/* Hamburger Dropdown Menu */
.hamburger-menu {
    position: fixed;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    position: relative;
}

.hamburger-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item:hover {
    background: var(--card-hover);
}

.menu-icon {
    margin-right: 12px;
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.menu-separator {
    height: 1px;
    background: var(--border-color);
    margin: 4px 0;
}

.theme-selector select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--input-bg);
    color: var(--text-color);
}

.sidebar-content {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h3 {
    color: var(--text-color);
    font-size: 1.1rem;
}

.add-btn {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    background: var(--primary-color);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.add-btn:hover {
    background: var(--primary-hover);
}

.categories-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.category-item {
    padding: 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
}

.category-item:hover {
    background: var(--card-hover);
}

.category-item.active {
    background: var(--primary-color);
    color: white;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.screen {
    display: none;
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

.screen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.screen-header h2 {
    color: var(--text-color);
    font-size: 1.8rem;
}

.deck-actions {
    display: flex;
    gap: 1rem;
}

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--secondary-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--secondary-hover);
}

/* Grids */
.decks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.deck-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.deck-card:hover {
    background: var(--card-hover);
    transform: translateY(-2px);
}

.deck-card h3 {
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.deck-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}


/* Study Screen */
.study-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: 8px;
}

.study-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.study-info span {
    color: var(--text-color);
    font-weight: 500;
}

.study-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    max-width: 900px;
    margin: 0 auto;
    min-height: 0; /* Changed from 600px */
    height: 100%; /* Use available height */
}

.card-content {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    min-height: 200px; /* Reduced from 300px */
    max-height: calc(100vh - 400px); /* Dynamically calculate based on viewport */
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    text-align: left;
    width: 100%;
    overflow-y: auto;
}

.card-image img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.card-text {
    font-size: 1.2rem;
    color: var(--text-color);
    white-space: pre-line;
    overflow-y: auto;
    flex: 1;
    width: 100%;
}

/* Ensure rating section is always visible */
.rating-section {
    margin-top: auto; /* Push to bottom of available space */
    padding-top: 1rem;
}

.rating-section p {
    color: var(--text-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.rating-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.rating-btn {
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    min-width: 120px;
}

.rating-btn[data-rating="1"] {
    background: #ef4444;
    color: white;
}

.rating-btn[data-rating="2"] {
    background: #f59e0b;
    color: white;
}

.rating-btn[data-rating="3"] {
    background: #0891b2;
    color: white;
}

.rating-btn[data-rating="4"] {
    background: #059669;
    color: white;
}

.rating-btn:hover {
    opacity: 0.8;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-color);
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    color: var(--text-color);
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.close-btn:hover {
    color: var(--text-color);
}

.modal-body {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-color);
    font-weight: 500;
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 0.9rem;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* Welcome screen */
#welcome-screen {
    align-items: center;
    justify-content: center;
    text-align: center;
}

#welcome-screen h2 {
    color: var(--text-color);
    margin-bottom: 1rem;
    font-size: 2rem;
}

#welcome-screen p {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Template-specific styles */
.shortcuts-content h4 {
    color: var(--primary-color);
    margin: 1rem 0 0.5rem 0;
}

.shortcuts-content h4:first-child {
    margin-top: 0;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.shortcut-item:last-child {
    border-bottom: none;
}

.shortcut-key {
    background: var(--card-bg);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85rem;
    border: 1px solid var(--border-color);
}

.shortcut-desc {
    color: var(--text-secondary);
}

.about-content h4 {
    color: var(--primary-color);
    margin: 1.5rem 0 0.5rem 0;
}

.about-content ul {
    margin: 0.5rem 0 1rem 1.5rem;
}

.about-content li {
    margin-bottom: 0.25rem;
    color: var(--text-color);
}

.study-summary { 
    text-align: center; 
}

.summary-stats { 
    display: flex; 
    justify-content: space-around; 
    margin: 2rem 0; 
}

.stat-item { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
}

.stat-value { 
    font-size: 2rem; 
    font-weight: bold; 
    color: var(--primary-color); 
}

.stat-label { 
    font-size: 0.9rem; 
    color: var(--text-secondary); 
    margin-top: 0.5rem; 
}

.btn-danger {
    background: #ef4444;
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Toast notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    z-index: 9999;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    max-width: 300px;
    word-wrap: break-word;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-info {
    background: var(--primary-color);
}

.toast-success {
    background: var(--success-color);
}

.toast-warning {
    background: var(--warning-color);
}

.toast-error {
    background: var(--error-color);
}

/* Context menu */
.context-menu {
    position: fixed;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    min-width: 150px;
}

.context-menu-item {
    padding: 8px 12px;
    cursor: pointer;
    color: var(--text-color);
    transition: background-color 0.2s;
}

.context-menu-item:hover {
    background-color: var(--card-hover);
}

/* Image preview */
.image-preview-wrapper {
    margin-top: 10px;
}

.image-preview-wrapper img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 4px;
    display: block;
    margin-bottom: 10px;
}

.remove-image-btn {
    padding: 5px 10px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.remove-image-btn:hover {
    background: #dc2626;
}

/* Initialization error */
.init-error-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    flex-direction: column;
    text-align: center;
    padding: 2rem;
    background: var(--bg-color);
    color: var(--text-color);
}

.init-error-title {
    color: #ef4444;
    margin-bottom: 1rem;
    font-size: 2rem;
}

.init-error-message {
    margin-bottom: 2rem;
    max-width: 500px;
    line-height: 1.6;
}

.init-error-details {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 2rem;
    font-family: monospace;
}

.init-error-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    margin: 0 0.5rem;
}

.init-error-btn-primary {
    background: var(--primary-color);
    color: white;
}

.init-error-btn-danger {
    background: #ef4444;
    color: white;
}

.category-actions {
    display: flex;
    gap: 1rem;
}


/* Deck card menu */
.deck-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.deck-card:hover {
    background: var(--card-hover);
    transform: translateY(-2px);
}

.deck-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.deck-card h3 {
    color: var(--text-color);
    margin: 0;
    flex: 1;
}

.deck-menu-btn {
    opacity: 0;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    line-height: 1;
}

.deck-card:hover .deck-menu-btn {
    opacity: 1;
}

.deck-menu-btn:hover {
    background: var(--card-bg);
    color: var(--text-color);
}

.deck-context-menu {
    position: fixed;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    min-width: 160px;
}

.deck-context-menu .menu-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color 0.2s;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
}

.deck-context-menu .menu-item:last-child {
    border-bottom: none;
}

.deck-context-menu .menu-item:hover {
    background: var(--card-hover);
}

.deck-context-menu .menu-icon {
    margin-right: 8px;
    font-size: 14px;
    width: 16px;
    text-align: center;
}

/* Preview Screen */
.preview-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 1000px;
    margin: 0 auto;
}

.preview-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    min-height: 100px;
}

.preview-card-front {
    flex: 1;
    padding-right: 1rem;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.preview-card-back {
    flex: 1;
    padding-left: 1rem;
    display: flex;
    flex-direction: column;
}

.preview-card-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.preview-card-content {
    color: var(--text-color);
    white-space: pre-line;
    line-height: 1.5;
}

.preview-card-image {
    margin-bottom: 0.5rem;
}

.preview-card-image img {
    max-width: 100%;
    max-height: 150px;
    border-radius: 4px;
}

.preview-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.preview-actions span {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.preview-more {
    text-align: center;
    margin-top: 2rem;
    padding: 1rem;
}

.preview-more button {
    padding: 1rem 2rem;
    font-size: 1rem;
}


.preview-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    display: flex;
    min-height: 100px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.preview-card:hover {
    background: var(--card-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Statistics Screen */
.statistics-content {
    padding: 1rem 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.2s;
}

.stat-card:hover {
    background: var(--card-hover);
    transform: translateY(-2px);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    line-height: 1;
}

.stat-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.5rem;
}

.stat-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

/* Sidebar Statistics */
.sidebar-stats {
    margin-top: 0.6rem;
    padding-top: 0;
    border-top: 1px solid var(--border-color);
}

.sidebar-stat {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.sidebar-stat .stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.sidebar-stat .stat-value {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
}

.sidebar-stat #current-streak {
    margin-right: 1rem;
}


/* Image modal styles */
.image-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    cursor: pointer;
}

.image-modal-image {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Clickable images in study mode */
.study-card-image img {
    cursor: pointer;
}

/* Delete button on preview cards */
.preview-card-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
    font-size: 14px;
    z-index: 10;
}

.preview-card {
    position: relative;
}

.preview-card:hover .preview-card-delete {
    opacity: 1;
}

.preview-card-delete:hover {
    background: #dc2626;
}

/* Wider modal for card editing */
.modal-content.wide {
    max-width: 800px;
    width: 95%;
}

/* Larger text areas for card content */
.modal-body textarea {
    min-height: 120px;
    resize: vertical;
}

/* Deck ID info modal styles */
.deck-id-info {
    font-family: monospace;
    margin: 1rem 0;
}

.deck-id-urls {
    margin: 1.5rem 0;
}

.deck-id-urls input[readonly] {
    width: 100%;
    padding: 8px;
    margin: 4px 0;
    font-family: monospace;
    font-size: 12px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-color);
}

.deck-id-note {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 1rem;
}

/* Home overview page styles */
.home-overview {
    max-width: 1200px;
    margin: 0 auto;
}

/* Updated home overview styles */
.overview-section {
    margin-bottom: 2.5rem;
}

.overview-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    font-size: 1.3rem;
}

.category-deck-list {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.deck-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.deck-line:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.deck-line:first-child {
    padding-top: 0;
}

.deck-info {
    flex: 1;
}

.deck-name {
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 0.25rem;
}

.deck-stats {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.deck-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.deck-action-link {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--secondary-color);
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.85rem;
    transition: all 0.2s;
    min-width: 60px;
    text-align: center;
}

.deck-action-link:hover {
    background: var(--secondary-hover);
    transform: translateY(-1px);
}

.deck-action-link.primary {
    background: var(--primary-color);
    color: var(--text-color);
    font-weight: 500;
}

.deck-action-link.primary:hover {
    background: var(--primary-hover);
}


/* Study mode button updates */
.study-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

.study-buttons button {
    flex: 1;
    max-width: 200px;
}

.sentence-reveal-container {
    margin-top: 1rem;
}

.sentence-reveal-text {
    margin-bottom: 1rem;
    line-height: 1.6;
}

.sentence-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Settings modal styles */
.settings-content {
  padding: 1rem 0;
}

.setting-description {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 0.5rem;
  margin-bottom: 0;
}

.category-item {
    padding: 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-item:hover {
    background: var(--card-hover);
}

.category-item.active {
    background: var(--primary-color);
    color: white;
}

.category-info {
    flex: 1;
}

.category-menu-btn {
    opacity: 0;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    line-height: 1;
}

.category-item:hover .category-menu-btn {
    opacity: 1;
}

.category-menu-btn:hover {
    background: var(--card-hover);
    color: var(--text-color);
}

.category-item.active .category-menu-btn {
    color: white;
}

.category-item.active .category-menu-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.category-context-menu {
    position: fixed;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1001;
    min-width: 160px;
}

.category-context-menu .menu-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color 0.2s;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
}

.category-context-menu .menu-item:last-child {
    border-bottom: none;
}

.category-context-menu .menu-item:hover {
    background: var(--card-hover);
}

.category-context-menu .menu-icon {
    margin-right: 8px;
    font-size: 14px;
    width: 16px;
    text-align: center;
}

/* Card front textarea - half size */
#card-front {
    min-height: 60px;
}

/* Card back textarea - double size */
#card-back {
    min-height: 300px;
}

/* Study mode selection buttons */
.study-mode-buttons {
  margin-bottom: 2rem;
  text-align: center;
}

.study-mode-selection {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.study-mode-btn {
  padding: 0.75rem 1.5rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--secondary-color);
  color: var(--text-color);
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
  min-width: 140px;
}

.study-mode-btn:hover {
  background: var(--secondary-hover);
  transform: translateY(-1px);
}

.study-mode-btn.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

/* Cloze-specific styles */
.card-content.cloze-mode {
  border-width: 4px;
  border-color: var(--cloze-border-color, var(--primary-color));
  background: var(--cloze-bg-color, var(--card-bg));
}

.cloze-info {
  font-size: 0.85rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
  text-align: center;
  font-weight: 500;
}

.cloze-text {
  line-height: 1.8;
  font-size: 1.1rem;
  transition: opacity 0.8s ease-in-out;
  white-space: pre-line;
}

.cloze-blank {
    display: inline-block;
    border-bottom: 2px solid var(--primary-color);
    min-width: 60px;
    height: 1.2em;
    margin: 0 2px;
    position: relative;
    background: var(--cloze-blank-bg, rgba(59, 130, 246, 0.1));
    border-radius: 2px;
    transition: all 0.6s ease-in-out;
}

/* Sentence reveal styles */
.sentence-reveal-container {
  margin-top: 1rem;
}

.sentence-reveal-text {
  margin-bottom: 1.5rem;
  line-height: 1.6;
  min-height: 100px;
}

.sentence-controls {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.sentence-controls button {
  min-width: 120px;
}

/* Adjust for laptop screens (1080p height) */
@media (max-height: 1100px) {
    .card-content {
        max-height: calc(100vh - 450px);
        min-height: 150px;
    }
    
    .study-card {
        padding: 0 1rem;
    }
}

/* Adjust for even smaller screens */
@media (max-height: 900px) {
    .card-content {
        max-height: calc(100vh - 400px);
        min-height: 100px;
        padding: 1.5rem;
    }
}
