/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    padding: 20px;
}

#app {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
h1 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 2em;
}

h2 {
    color: #34495e;
    margin-bottom: 15px;
    font-size: 1.5em;
}

h3 {
    color: #555;
    margin-bottom: 10px;
    font-size: 1.2em;
}

/* Buttons */
button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #2980b9;
}

button:active {
    background-color: #21618c;
}

button.secondary {
    background-color: #95a5a6;
}

button.secondary:hover {
    background-color: #7f8c8d;
}

button.danger {
    background-color: #e74c3c;
}

button.danger:hover {
    background-color: #c0392b;
}

button.success {
    background-color: #27ae60;
}

button.success:hover {
    background-color: #229954;
}

button:disabled {
    background-color: #bdc3c7;
    cursor: not-allowed;
}

/* Cards and containers */
.card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.deck-section {
    background: white;
    border-radius: 8px;
    padding: 0;
    margin-bottom: 0.5em;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.deck-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid #ecf0f1;
    gap: 15px;
}

.deck-item:last-child {
    border-bottom: none;
}

.deck-main {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.deck-info {
    flex: 1;
}

.deck-name {
    font-weight: 600;
    font-size: 1.1em;
    color: #2c3e50;
}

.deck-meta {
    font-size: 0.9em;
    color: #7f8c8d;
    margin-top: 5px;
}

.manage-link {
    color: #7f8c8d;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s;
}

.manage-link:hover {
    color: #3498db;
    text-decoration: underline;
}

.schedule-link {
    text-decoration: none;
    cursor: pointer;
    font-weight: 600;
}

.schedule-link:hover {
    text-decoration: underline;
}

.deck-actions {
    display: flex;
    gap: 10px;
}

.deck-actions button {
    padding: 8px 15px;
    font-size: 0.9em;
}

.quick-schedule {
    gap: 8px;
}

.quick-schedule-btn {
    padding: 6px 12px;
    font-size: 0.85em;
    background-color: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.quick-schedule-btn:hover {
    background-color: #2980b9;
}

.quick-schedule-btn:active {
    background-color: #21618c;
}

.schedule-custom-btn {
    padding: 6px 12px;
    font-size: 0.85em;
}

/* Deck section header */
.deck-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 15px 10px 15px;
    margin-bottom: 0;
}

.deck-section-header h3 {
    margin-bottom: 0;
}

.schedule-group-header {
    font-size: 0.9em;
    color: #7f8c8d;
    font-weight: 600;
    text-transform: uppercase;
    padding: 10px 15px 5px 15px;
    margin: 0;
    border-top: 1px solid #ecf0f1;
}

.schedule-group-header:first-of-type {
    border-top: none;
}

/* Header actions */
.header-actions {
    display: flex;
    gap: 8px;
}

/* New deck button */
.new-deck-btn {
    font-size: 1.2em;
    padding: 5px 15px;
    border-radius: 5px;
    background-color: #3498db;
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.new-deck-btn:hover {
    background-color: #2980b9;
}

.new-deck-btn:active {
    background-color: #21618c;
}

/* Import deck button */
.import-deck-btn {
    font-size: 1.2em;
    padding: 5px 15px;
    border-radius: 5px;
    background-color: #27ae60;
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.import-deck-btn:hover {
    background-color: #229954;
}

.import-deck-btn:active {
    background-color: #1e8449;
}

/* Review button icon */
.review-btn-icon {
    background-color: #27ae60;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.2s;
    flex-shrink: 0;
    padding: 0;
    text-indent: 2px;
}

.review-btn-icon:hover {
    background-color: #229954;
    transform: scale(1.1);
}

.review-btn-icon:active {
    background-color: #1e8449;
    transform: scale(0.95);
}

.review-btn-icon.has-session {
    background-color: #e67e22;
}

.review-btn-icon.has-session:hover {
    background-color: #d35400;
}

.review-btn-icon.has-session:active {
    background-color: #ba4a00;
}

/* Session progress indicator */
.session-progress {
    color: #e67e22;
    font-weight: 600;
    font-size: 0.9em;
}

.reset-session-btn {
    background: none;
    border: none;
    color: #95a5a6;
    cursor: pointer;
    font-size: 0.85em;
    padding: 0 4px;
    margin-left: 4px;
}

.reset-session-btn:hover {
    color: #e74c3c;
}

/* Review status */
.status-due {
    color: #e74c3c;
    font-weight: 600;
}

.status-active {
    color: #27ae60;
    font-weight: 600;
}

.status-scheduled {
    color: #3498db;
}

/* Forms */
input[type="text"],
input[type="date"],
textarea,
select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 1em;
    font-family: inherit;
    margin-bottom: 10px;
}

textarea {
    min-height: 100px;
    resize: vertical;
    font-family: 'Courier New', monospace;
}

label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
}

.form-group {
    margin-bottom: 20px;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Flashcard review */
.flashcard-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
    margin: 40px 0;
}

.flashcard {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 600px;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.flashcard:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.flashcard-content {
    font-size: 1.3em;
    line-height: 1.8;
}

.flashcard-hint {
    margin-top: 20px;
    color: #95a5a6;
    font-size: 0.9em;
}

.review-controls {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 30px;
}

.review-controls button {
    padding: 15px 40px;
    font-size: 1.1em;
}

.review-progress {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1em;
    color: #7f8c8d;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    background: white;
    border-radius: 8px;
    padding: 45px;
    max-width: 750px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}

.modal h2 {
    margin-top: 0;
}

.modal-close {
    float: right;
    font-size: 1.5em;
    background: none;
    border: none;
    cursor: pointer;
    color: #95a5a6;
    padding: 0;
    width: 30px;
    height: 30px;
}

.modal-close:hover {
    color: #7f8c8d;
}

/* Card list in manager */
.card-list-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 15px;
    border-bottom: 1px solid #ecf0f1;
    gap: 15px;
}

.card-list-item:last-child {
    border-bottom: none;
}

.card-content-preview {
    flex: 1;
}

.card-front,
.card-back {
    margin-bottom: 8px;
}

.card-label {
    font-weight: 600;
    color: #7f8c8d;
    font-size: 0.85em;
    text-transform: uppercase;
}

.card-back .latex-preview {
    filter: blur(5px);
    transition: filter 0.2s;
    cursor: pointer;
    user-select: none;
}

.card-back .latex-preview.revealed {
    filter: blur(0);
}

.card-actions {
    display: flex;
    gap: 8px;
}

.card-actions button {
    padding: 6px 12px;
    font-size: 0.85em;
}

.card-actions .icon-btn {
    padding: 6px 10px;
    font-size: 1.3em;
    line-height: 1;
}

/* Preview */
.preview-box {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    padding: 15px;
    margin-top: 10px;
    min-height: 60px;
}

/* Offline indicator */
.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: #f39c12;
    color: white;
    text-align: center;
    padding: 10px;
    font-weight: 600;
    z-index: 2000;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Statistics styling */
.stats-text {
    font-size: 0.85em;
    color: #7f8c8d;
}

.accuracy-high {
    color: #27ae60;
    font-weight: 600;
}

.accuracy-medium {
    color: #f39c12;
    font-weight: 600;
}

.accuracy-low {
    color: #e74c3c;
    font-weight: 600;
}

/* Deck stats summary panel */
.deck-stats-summary {
    background-color: #f8f9fa;
    padding: 15px;
    margin-bottom: 15px;
    border-radius: 5px;
    border: 1px solid #e1e8ed;
}

/* Card statistics row */
.card-stats {
    font-size: 0.8em;
    color: #95a5a6;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #ecf0f1;
}

/* Mastery badges */
.mastery-badge {
    display: inline-block;
    font-size: 1.2em;
    margin-left: 5px;
}

/* Utility classes */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.mb-20 {
    margin-bottom: 20px;
}

.mt-20 {
    margin-top: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .flashcard {
        min-width: 100%;
        padding: 30px 20px;
    }

    .deck-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .deck-actions {
        width: 100%;
    }

    .deck-actions button {
        flex: 1;
    }

    .card-list-item {
        flex-direction: column;
    }

    .card-actions {
        width: 100%;
    }

    .card-actions button {
        flex: 1;
    }
}
