/* Custom checkbox styling - requires custom CSS for custom appearance */
input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-radius: 0.25rem;
    cursor: pointer;
    position: relative;
    background: white;
    transition: all 0.2s;
}

input[type="checkbox"]:checked {
    background: #3b82f6;
    border-color: #3b82f6;
}

input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: translate(-50%, -60%) rotate(45deg);
}

.dark input[type="checkbox"] {
    border-color: #4b5563;
    background: #1f2937;
}

.dark input[type="checkbox"]:checked {
    background: #8b5cf6;
    border-color: #8b5cf6;
}

/* Loading spinner animation */
.loading-spinner {
    border: 4px solid #f3f4f6;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

.dark .loading-spinner {
    border-color: #374151;
    border-top-color: #8b5cf6;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Flashcard flip animation */
.flashcard {
    perspective: 1000px;
    width: 100%;
    max-width: 600px;
    height: 400px;
    margin: 0 auto;
    cursor: pointer;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card-inner.flipped {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.card-front {
    background: white;
    color: #111827;
}

.dark .card-front {
    background: #1f2937;
    color: #f9fafb;
}

.card-back {
    background: #f3f4f6;
    color: #111827;
    transform: rotateY(180deg);
}

.dark .card-back {
    background: #374151;
    color: #f9fafb;
}

/* Progress separator */
.progress-separator {
    margin: 0 0.5rem;
    color: #9ca3af;
    opacity: 0.5;
}

.dark .progress-separator {
    color: #6b7280;
}

/* Success rate badges */
.success-rate-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    font-weight: 600;
    font-size: 0.875rem;
}

.success-rate-badge.success-high {
    background-color: #d1fae5;
    color: #065f46;
}

.dark .success-rate-badge.success-high {
    background-color: #064e3b;
    color: #6ee7b7;
}

.success-rate-badge.success-medium {
    background-color: #fef3c7;
    color: #92400e;
}

.dark .success-rate-badge.success-medium {
    background-color: #78350f;
    color: #fde68a;
}

.success-rate-badge.success-low {
    background-color: #fee2e2;
    color: #991b1b;
}

.dark .success-rate-badge.success-low {
    background-color: #7f1d1d;
    color: #fca5a5;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 50;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 0.5rem;
    padding: 1.5rem;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    width: 100%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Smaller modal variant for account settings and similar pages */
.modal-content.modal-sm {
    max-width: 500px;
}

.dark .modal-content,
html.dark .modal-content,
body.dark .modal-content {
    background: #1f2937;
}

@media (max-width: 640px) {
    .modal-content {
        padding: 1rem;
        max-width: 95%;
    }
}

/* Custom dropdown for category selection */
.custom-dropdown {
    position: relative;
    width: 100%;
}

.category-input {
    width: 100%;
    padding: 0.75rem 3rem 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    background: white;
    color: #111827;
    font-size: 1rem;
    transition: all 0.2s;
}

.category-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.dark .category-input {
    background: #1f2937;
    border-color: #4b5563;
    color: #f9fafb;
}

.dark .category-input:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.dropdown-toggle {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: color 0.2s;
}

.dropdown-toggle:hover {
    color: #374151;
}

.dark .dropdown-toggle {
    color: #9ca3af;
}

.dark .dropdown-toggle:hover {
    color: #d1d5db;
}

.dropdown-arrow {
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.custom-dropdown.open .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.5rem;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    max-height: 200px;
    overflow-y: auto;
    display: none;
    z-index: 10;
}

.custom-dropdown.open .dropdown-menu {
    display: block;
}

.dark .dropdown-menu {
    background: #1f2937;
    border-color: #4b5563;
}

.dropdown-option {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    color: #111827;
}

.dropdown-option:hover {
    background-color: #f3f4f6;
}

.dropdown-option.highlighted {
    background-color: #eff6ff;
}

.dark .dropdown-option {
    color: #f9fafb;
}

.dark .dropdown-option:hover {
    background-color: #374151;
}

.dark .dropdown-option.highlighted {
    background-color: #312e81;
}

/* Card edit container styles */
.card-edit-container {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: all 0.2s;
}

.card-edit-container:hover {
    border-color: #d1d5db;
}

.dark .card-edit-container {
    background: #374151;
    border-color: #4b5563;
}

.dark .card-edit-container:hover {
    border-color: #6b7280;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-number {
    font-weight: 600;
    color: #374151;
    font-size: 0.875rem;
}

.dark .card-number {
    color: #d1d5db;
}

.delete-card-button {
    padding: 0.5rem 1rem;
    background: #fee2e2;
    color: #991b1b;
    border: none;
    border-radius: 0.375rem;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.delete-card-button:hover {
    background: #fecaca;
}

.dark .delete-card-button {
    background: #7f1d1d;
    color: #fca5a5;
}

.dark .delete-card-button:hover {
    background: #991b1b;
}

.card-edit-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 768px) {
    .card-edit-fields {
        grid-template-columns: 1fr;
    }
}

.card-edit-input {
    width: 100%;
    min-height: 120px;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    background: white;
    color: #111827;
    font-size: 1rem;
    resize: vertical;
    font-family: inherit;
    transition: all 0.2s;
}

.card-edit-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.card-edit-input::placeholder {
    color: #9ca3af;
}

.dark .card-edit-input {
    background: #1f2937;
    border-color: #4b5563;
    color: #f9fafb;
}

.dark .card-edit-input:focus {
    border-color: #8b5cf6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.dark .card-edit-input::placeholder {
    color: #6b7280;
}

/* Edit actions buttons */
.edit-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.edit-action-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.edit-action-btn-primary {
    background: #3b82f6;
    color: white;
}

.edit-action-btn-primary:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.dark .edit-action-btn-primary {
    background: #8b5cf6;
}

.dark .edit-action-btn-primary:hover {
    background: #7c3aed;
}

.edit-action-btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.edit-action-btn-secondary:hover {
    background: #e5e7eb;
    transform: translateY(-1px);
}

.dark .edit-action-btn-secondary {
    background: #4b5563;
    color: #f9fafb;
}

.dark .edit-action-btn-secondary:hover {
    background: #6b7280;
}

.edit-action-btn-danger {
    background: #fee2e2;
    color: #991b1b;
}

.edit-action-btn-danger:hover {
    background: #fecaca;
    transform: translateY(-1px);
}

.dark .edit-action-btn-danger {
    background: #7f1d1d;
    color: #fca5a5;
}

.dark .edit-action-btn-danger:hover {
    background: #991b1b;
}

.edit-action-btn-tertiary {
    background: #f9fafb;
    color: #6b7280;
    border: 2px solid #e5e7eb;
}

.edit-action-btn-tertiary:hover {
    background: #f3f4f6;
    transform: translateY(-1px);
}

.dark .edit-action-btn-tertiary {
    background: #374151;
    color: #d1d5db;
    border-color: #4b5563;
}

.dark .edit-action-btn-tertiary:hover {
    background: #4b5563;
}

/* Save modal overlay */
.save-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 50;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.save-modal-overlay.show {
    display: flex;
}

.save-modal-content {
    background: white;
    border-radius: 0.75rem;
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.dark .save-modal-content {
    background: #1f2937;
}

.save-modal-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.save-modal-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

@media (min-width: 640px) {
    .save-modal-actions {
        flex-direction: row;
        justify-content: center;
    }
    
    .save-modal-actions .edit-action-btn {
        flex: 1;
        max-width: 200px;
    }
}

/* Card deletion animation */
@keyframes slideOut {
    0% {
        opacity: 1;
        transform: translateX(0);
    }
    100% {
        opacity: 0;
        transform: translateX(-100%);
    }
}

