/* ========================================
   RESET & BASE STYLES
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

html {
    scroll-behavior: smooth;
}

/* ========================================
   LAYOUT STRUCTURE
   ======================================== */

.app-shell {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 0;
}

.container {
    width: 100%;
    max-width: 900px;
    padding: 0;
}

main {
    padding: 0;
}

/* ========================================
   HEADER
   ======================================== */

.app-header {
    text-align: center;
    color: white;
    margin-bottom: 40px;
    padding-top: 20px;
}

.app-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.15);
    letter-spacing: -0.5px;
}

.app-subtitle {
    font-size: 1.1rem;
    font-weight: 300;
    opacity: 0.95;
    margin: 0;
}

/* ========================================
   CARD COMPONENT
   ======================================== */

.card {
    background: white;
    border-radius: 16px;
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.card h2 {
    font-size: 1.4rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 22px;
    padding-bottom: 16px;
    border-bottom: 3px solid #667eea;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ========================================
   FORM ELEMENTS
   ======================================== */

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

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: #444;
    font-size: 0.95rem;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="file"],
.form-group input[type="number"],
.select-input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    background: white;
    transition: border-color 0.3s, background-color 0.3s;
}

.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="number"]:focus,
.select-input:focus {
    outline: none;
    border-color: #667eea;
    background: #f9f9ff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group input[type="file"] {
    padding: 10px;
}

.form-group input[type="checkbox"],
.form-group input[type="radio"] {
    margin-right: 8px;
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: #667eea;
}

.form-group label input[type="checkbox"],
.form-group label input[type="radio"] {
    margin-right: 10px;
}

.select-input {
    cursor: pointer;
    background: white;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23667eea' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.select-input:disabled {
    background-color: #f5f5f5;
    color: #999;
    cursor: not-allowed;
    border-color: #ddd;
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
    white-space: nowrap;
    user-select: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Primary Button */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

/* Secondary Button */
.btn-secondary {
    background: #f0f0f0;
    color: #333;
    border: 2px solid #e0e0e0;
}

.btn-secondary:hover:not(:disabled) {
    background: #e8e8e8;
    border-color: #d0d0d0;
}

/* Success Button */
.btn-success {
    background: linear-gradient(135deg, #34d399 0%, #10b981 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 185, 129, 0.6);
}

/* Danger/Warning Button */
.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

/* Button Groups */
.button-group {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

/* ========================================
   RADIO BUTTON GROUPS
   ======================================== */

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.radio-option {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
    user-select: none;
}

.radio-option:hover {
    background-color: #f9f9ff;
}

.radio-option input[type="radio"] {
    cursor: pointer;
}

/* ========================================
   STATUS MESSAGES
   ======================================== */

.status-message {
    padding: 14px 16px;
    border-radius: 8px;
    margin-top: 12px;
    margin-bottom: 12px;
    font-size: 0.9rem;
    border-left: 4px solid;
    display: none;
}

.status-message.error {
    display: block;
    background: #fee;
    color: #c33;
    border-color: #c33;
}

.status-message.success {
    display: block;
    background: #efe;
    color: #3c3;
    border-color: #3c3;
}

.status-message.info {
    display: block;
    background: #eef;
    color: #33c;
    border-color: #33c;
}

/* ========================================
   DOWNLOAD LINKS
   ======================================== */

.download-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.download-link {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: #f9f9ff;
    border: 2px solid #667eea;
    border-radius: 8px;
    text-decoration: none;
    color: #667eea;
    font-weight: 500;
    transition: all 0.3s;
}

.download-link:hover {
    background: #667eea;
    color: white;
}

.download-link::before {
    content: "📥";
    margin-right: 10px;
    font-size: 1.2rem;
}

/* ========================================
   RUBRIC PREVIEW
   ======================================== */

.rubric-preview {
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 16px;
    margin-top: 12px;
    max-height: 300px;
    overflow-y: auto;
    font-size: 0.9rem;
    color: #555;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: 'Courier New', monospace;
}

/* ========================================
   LLM SECTION (COMING SOON)
   ======================================== */

.llm-banner {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border: 2px solid #f59e0b;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    text-align: center;
    color: white;
}

.llm-banner h3 {
    margin: 0 0 10px 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.llm-banner p {
    margin: 0;
    font-size: 0.95rem;
    opacity: 0.95;
}

/* ========================================
   ANIMATIONS
   ======================================== */

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

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    animation: spin 1s linear infinite;
}

.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 20px;
    color: #667eea;
    text-align: center;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    .app-header h1 {
        font-size: 1.8rem;
    }

    .app-subtitle {
        font-size: 0.95rem;
    }

    .container {
        max-width: 100%;
    }

    .card {
        padding: 20px;
        margin-bottom: 16px;
    }

    .card h2 {
        font-size: 1.2rem;
        margin-bottom: 16px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }

    .button-group {
        gap: 10px;
    }

    .radio-group {
        gap: 10px;
    }

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

    .select-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

@media (max-width: 480px) {
    body {
        padding: 12px;
    }

    .app-header {
        margin-bottom: 24px;
        padding-top: 12px;
    }

    .app-header h1 {
        font-size: 1.5rem;
    }

    .app-subtitle {
        font-size: 0.85rem;
    }

    .card {
        padding: 16px;
        border-radius: 12px;
    }

    .card h2 {
        font-size: 1.1rem;
    }

    .btn {
        padding: 10px 16px;
        font-size: 0.85rem;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.hidden {
    display: none !important;
}

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

.text-muted {
    color: #999;
    font-size: 0.9rem;
}

.gap-sm {
    gap: 8px;
}

.gap-md {
    gap: 16px;
}

.gap-lg {
    gap: 24px;
}

/* Grid Layouts */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

@media (max-width: 640px) {
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}

/* ============================================================================
   Loading Modal Styles
   ============================================================================ */

.loading-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(2px);
}

.loading-content {
    background: white;
    border-radius: 12px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.loading-content h2 {
    margin-top: 20px;
    margin-bottom: 30px;
    color: #333;
    font-size: 24px;
}

/* Spinner animation */
.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto;
    border: 4px solid #f0f0f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Progress steps */
.progress-steps {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
    text-align: left;
}

.progress-step {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border-radius: 6px;
    background: #f8f9fa;
    color: #666;
    font-size: 14px;
    transition: all 0.3s ease;
}

.progress-step.active {
    background: #e8eaf6;
    color: #667eea;
    font-weight: 500;
}

.progress-step.completed {
    background: #e8f5e9;
    color: #4caf50;
}

.step-icon {
    font-size: 18px;
    min-width: 24px;
    text-align: center;
}

.progress-step.active .step-icon {
    animation: pulse 1s ease-in-out infinite;
}

.progress-step.completed .step-icon {
    animation: none;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.step-text {
    flex: 1;
}
