/* ========================================
   STUDIQ - Flashcard Editor Styles
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #fafafa;
    min-height: 100vh;
    padding-bottom: 2rem;
}

/* Header */
.editor-header {
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 2px solid rgba(198, 167, 255, 0.3);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-header h1 {
    font-size: 1.5rem;
    color: #C6A7FF;
    text-shadow: 0 0 10px rgba(198, 167, 255, 0.5);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

#userEmail {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

/* Main Container */
.editor-container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 2rem;
}

/* Editor Panel */
.editor-panel {
    background: rgba(26, 26, 46, 0.8);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(198, 167, 255, 0.3);
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: 0 10px 40px rgba(198, 167, 255, 0.2);
}

.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-group label {
    display: block;
    color: #C6A7FF;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-group input,
.form-group textarea {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    padding: 0.875rem;
    color: #fafafa;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #C6A7FF;
    background: rgba(198, 167, 255, 0.05);
    box-shadow: 0 0 20px rgba(198, 167, 255, 0.3);
}

.form-group textarea {
    resize: vertical;
    min-height: 150px;
}

.char-count {
    position: absolute;
    right: 0.5rem;
    bottom: -1.5rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

/* Buttons */
.editor-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-primary,
.btn-secondary,
.btn-logout {
    padding: 0.875rem 1.5rem;
    border: none;
    border-radius: 0.75rem;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: linear-gradient(135deg, #C6A7FF, #6C63FF);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(198, 167, 255, 0.5);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fafafa;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(198, 167, 255, 0.5);
}

.btn-logout {
    background: rgba(255, 82, 82, 0.2);
    color: #ff5252;
    border: 2px solid #ff5252;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

.btn-logout:hover {
    background: rgba(255, 82, 82, 0.3);
}

/* Message Box */
.message-box {
    margin-top: 1.5rem;
    padding: 1rem;
    border-radius: 0.75rem;
    font-weight: 500;
}

.message-box.success {
    background: rgba(102, 255, 178, 0.1);
    border: 2px solid #66ffb2;
    color: #66ffb2;
}

.message-box.error {
    background: rgba(255, 82, 82, 0.1);
    border: 2px solid #ff5252;
    color: #ff5252;
}

/* Reference Panel */
.ref-panel {
    background: rgba(26, 26, 46, 0.8);
    backdrop-filter: blur(20px);
    border: 2px solid rgba(198, 167, 255, 0.3);
    border-radius: 1.5rem;
    padding: 1.5rem;
    box-shadow: 0 10px 40px rgba(198, 167, 255, 0.2);
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.ref-panel h3 {
    color: #C6A7FF;
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.panel-info {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

/* Drop Zone */
.dropzone {
    border: 3px dashed rgba(198, 167, 255, 0.3);
    border-radius: 1rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: rgba(255, 255, 255, 0.02);
    margin-bottom: 1.5rem;
}

.dropzone:hover,
.dropzone.drag-over {
    border-color: #C6A7FF;
    background: rgba(198, 167, 255, 0.05);
    transform: scale(1.02);
}

.dropzone-content {
    pointer-events: none;
}

.dropzone-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
}

.dropzone p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 0.5rem;
}

.dropzone-hint {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
}

/* Thumbnails Container */
.thumbs-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.thumb-item {
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    padding: 0.5rem;
    transition: all 0.3s;
}

.thumb-item:hover {
    border-color: #C6A7FF;
    transform: translateY(-2px);
}

.thumb-image {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: 0.5rem;
    cursor: pointer;
}

.thumb-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.thumb-progress {
    font-size: 0.8rem;
    color: #ffd600;
    font-weight: 600;
}

.thumb-remove {
    background: rgba(255, 82, 82, 0.2);
    color: #ff5252;
    border: none;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s;
}

.thumb-remove:hover {
    background: rgba(255, 82, 82, 0.4);
}

.thumb-status {
    color: #10b981;
    font-weight: 600;
    font-size: 0.875rem;
}

.thumb-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: rgba(139, 92, 246, 0.05);
    border-radius: 0.5rem;
    color: #8b5cf6;
    font-weight: 600;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: rgba(26, 26, 46, 0.95);
    border: 2px solid rgba(198, 167, 255, 0.5);
    border-radius: 1.5rem;
    padding: 2rem;
    max-width: 500px;
    text-align: center;
    position: relative;
}

.modal-content h2 {
    color: #C6A7FF;
    margin-bottom: 1rem;
}

.modal-content p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.modal-large {
    max-width: 90%;
    max-height: 90%;
    padding: 1rem;
}

.modal-large img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 0.75rem;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 82, 82, 0.2);
    color: #ff5252;
    border: none;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.modal-close:hover {
    background: rgba(255, 82, 82, 0.4);
    transform: rotate(90deg);
}

/* Scrollbar */
.ref-panel::-webkit-scrollbar {
    width: 8px;
}

.ref-panel::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.ref-panel::-webkit-scrollbar-thumb {
    background: rgba(198, 167, 255, 0.5);
    border-radius: 4px;
}

.ref-panel::-webkit-scrollbar-thumb:hover {
    background: rgba(198, 167, 255, 0.7);
}

/* Live Preview */
.live-preview {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid rgba(198, 167, 255, 0.2);
}

.live-preview h3 {
    color: #C6A7FF;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.preview-card {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(198, 167, 255, 0.3);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(198, 167, 255, 0.1);
    transition: all 0.3s;
}

.preview-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(198, 167, 255, 0.2);
}

.preview-image-container {
    margin-bottom: 1rem;
}

.preview-image {
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
}

.preview-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.preview-question,
.preview-answer {
    padding: 1rem;
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
}

.preview-question strong,
.preview-answer strong {
    display: block;
    color: #C6A7FF;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.preview-text {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
    min-height: 2rem;
    font-style: italic;
    transition: all 0.3s;
}

.preview-text:not(:empty) {
    font-style: normal;
}

/* Responsive */
@media (max-width: 1024px) {
    .editor-container {
        grid-template-columns: 1fr;
    }

    .ref-panel {
        position: relative;
        top: 0;
        max-height: none;
    }
}

@media (max-width: 768px) {
    .editor-container {
        padding: 0 1rem;
    }

    .editor-header {
        padding: 1rem;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .editor-actions {
        flex-direction: column;
    }

    .thumbs-container {
        grid-template-columns: 1fr;
    }
}
