@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root {
    --primary: var(--scac-primary);
    /* Executive Royal Blue */
    --primary-dark: var(--scac-primary-dark);
    --primary-soft: var(--scac-primary-soft);

    --bg-platinum: var(--scac-bg);
    --surface: var(--scac-surface);

    --text-main: var(--scac-text);
    /* Absolute Black */
    --text-secondary: #1e293b;
    --text-muted: var(--scac-text-muted);

    --border: var(--scac-border);
    --border-focus: #004aad;

    --glass-blur: blur(14px);
    --glass-border: rgba(255, 255, 255, 0.6);

    --success: #10b981;
    --error: #ef4444;

    --shadow-subtle: var(--scac-shadow-subtle);
    --shadow-premium: var(--scac-shadow-premium);
    --shadow-hover: var(--scac-shadow-hover);
    --focus-ring: var(--scac-focus-ring);

    --radius-sm: var(--scac-radius-sm);
    --radius-md: var(--scac-radius-md);
    --radius-lg: var(--scac-radius-lg);
    --radius-capsule: var(--scac-radius-pill);

    --transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-platinum);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 60px 20px;
    line-height: 1.6;
    background-image: radial-gradient(circle at top right, rgba(15, 23, 42, 0.02) 0%, transparent 50%);
}

.container {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    width: 100%;
    max-width: 1250px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-premium);
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.5);
    animation: slideUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Premium Header ── */
.premium-header {
    background: linear-gradient(135deg, rgba(0, 74, 173, 0.05) 0%, rgba(255, 255, 255, 0.2) 100%);
    padding: 20px 48px;
    display: flex;
    align-items: center;
    gap: 24px;
    border-bottom: 1px solid var(--border);
}

.header-center-block {
    flex: 1;
    text-align: center;
}

.scac-brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    flex-shrink: 0;
}

.scac-brand-logo {
    height: 38px;
    width: auto;
    object-fit: contain;
}

.scac-brand-text {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.header-logo {
    height: 48px;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.05));
    transition: var(--transition);
}

.header-logo:hover {
    transform: scale(1.05);
}

.college-name {
    font-size: 13px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

.display-title {
    font-size: 32px;
    font-weight: 900;
    color: var(--primary);
    margin-bottom: 12px;
    letter-spacing: -1px;
    line-height: 1.1;
}

.sub-premium {
    font-size: 15px;
    color: #000000;
    font-weight: 600;
    opacity: 0.8;
}

/* ── Form Layout ── */
.split-layout {
    display: flex;
    gap: 32px;
    padding: 32px;
}

.form-column {
    flex: 2;
    min-width: 0;
}

.history-column {
    flex: 1;
    min-width: 320px;
}

form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.form-glass-section {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 32px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.05);
}

/* Section Colors */
.section-blue::before {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.15) 0%, transparent 100%);
}

.section-green::before {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.15) 0%, transparent 100%);
}

.section-amber::before {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, transparent 100%);
}

.form-glass-section::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
}

.form-section-title {
    font-size: 14px;
    font-weight: 900;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-section-title-split {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-assist-btn {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.ai-assist-btn:hover {
    transform: scale(1.05);
}

.ai-btn-active {
    background: linear-gradient(135deg, #4f46e5, #7c3aed) !important;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.5) !important;
}

/* ── AI Inline Panel ── */
.ai-inline-panel {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.ai-inline-panel.ai-panel-visible {
    grid-template-rows: 1fr;
}

.ai-panel-inner {
    min-height: 0;
    padding: 0;
    transition: padding 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.ai-panel-visible .ai-panel-inner {
    padding: 14px 0 4px;
}

.ai-panel-prompt-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.ai-topic-wrap {
    flex: 1;
}

.ai-topic-textarea {
    width: 100%;
    resize: none;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    padding: 10px 14px;
    border: 1.5px solid rgba(99, 102, 241, 0.3);
    border-radius: var(--radius-md);
    outline: none;
    background: rgba(99, 102, 241, 0.04);
    color: var(--text-main);
    line-height: 1.5;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ai-topic-textarea:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

.ai-generate-btn {
    white-space: nowrap;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    border: none;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transition: opacity 0.2s, transform 0.2s;
    flex-shrink: 0;
}

.ai-generate-btn:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
}

.ai-generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Preview area */
.ai-preview-area {
    margin-top: 14px;
    background: rgba(99, 102, 241, 0.04);
    border: 1.5px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-md);
    padding: 16px 18px;
    animation: fadeSlideIn 0.3s ease;
}

@keyframes fadeSlideIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.ai-preview-field {
    margin-bottom: 12px;
}

.ai-preview-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6366f1;
    margin-bottom: 5px;
}

.ai-preview-value {
    font-size: 14px;
    color: var(--text-main);
    font-weight: 600;
    line-height: 1.5;
}

.ai-preview-desc {
    font-weight: 400;
    color: var(--text-secondary);
    white-space: pre-wrap;
    max-height: 140px;
    overflow-y: auto;
}

.ai-preview-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(99, 102, 241, 0.15);
}

.ai-discard-btn {
    padding: 7px 16px;
    border-radius: 8px;
    border: 1.5px solid #e2e8f0;
    background: white;
    color: #64748b;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.ai-discard-btn:hover { background: #f8fafc; }

.ai-accept-btn {
    padding: 7px 18px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    transition: opacity 0.15s, transform 0.15s;
}

.ai-accept-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

/* shimmer on title/desc while generating */
@keyframes aiShimmer {
    0%   { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

.ai-shimmer {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%) !important;
    background-size: 800px 100% !important;
    animation: aiShimmer 1.2s infinite linear !important;
    color: transparent !important;
    border-radius: 6px !important;
    pointer-events: none;
}

.is-hidden {
    display: none;
}

.form-section-title i {
    font-size: 16px;
    color: var(--primary);
}

.full-width {
    grid-column: 1 / -1;
}

label {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 10px;
    color: #000000;
    display: flex;
    align-items: center;
    gap: 4px;
}

label .required {
    color: var(--error);
    font-size: 16px;
}

.input-wrapper {
    position: relative;
    margin-bottom: 24px;
}

.input-wrapper i.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
    transition: var(--transition);
    z-index: 1;
}

.input-wrapper.textarea-wrapper i.input-icon {
    top: 18px;
    transform: none;
}

input,
select,
textarea {
    width: 100%;
    padding: 14px 16px 14px 44px;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border);
    font-size: 15px;
    font-family: inherit;
    transition: var(--transition);
    background: #ffffff;
    color: var(--text-main);
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    cursor: pointer;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.input-wrapper:focus-within i.input-icon {
    color: var(--primary);
}

textarea {
    resize: vertical;
    min-height: 120px;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
    font-weight: 500;
}

.row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* ── File Upload ── */
.file-input-wrapper {
    position: relative;
    background: #f8fafc;
    border: 2px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 40px 20px;
    text-align: center;
    margin-bottom: 16px;
    transition: var(--transition);
    cursor: pointer;
}

.file-input-wrapper:hover {
    border-color: var(--primary);
    background: #f1f5f9;
}

.file-input-wrapper.has-files {
    border-color: var(--success);
    background: #f0fdf4;
}

.file-input-wrapper input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.file-input-label .upload-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.2);
    color: #ffffff;
    font-size: 20px;
}

.file-input-label span {
    display: block;
    font-weight: 700;
    color: var(--primary);
    font-size: 15px;
    margin-bottom: 4px;
}

.file-input-label small {
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
}

/* ── File List ── */
.file-item {
    padding: 12px 18px;
    margin-bottom: 8px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
}

.file-item .file-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: var(--primary-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 16px;
}

.file-item .file-name {
    flex: 1;
    font-weight: 600;
    color: var(--text-main);
}

.file-item .file-size {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
}

/* ── Submit ── */
.submit-area {
    padding: 0 24px 32px;
}

.submit-message {
    margin-top: 24px;
    padding: 18px;
    border-radius: 12px;
    display: none;
    text-align: center;
    font-weight: 700;
}

button[type="submit"] {
    width: 100%;
    padding: 22px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-capsule);
    font-weight: 900;
    font-size: 18px;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 10px 25px -5px rgba(0, 74, 173, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

button[type="submit"]:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(30, 58, 138, 0.28);
}

button[type="submit"]:active {
    transform: translateY(-1px);
}

/* ── Thank You Overlay ── */
.thankyou-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.thankyou-overlay.active {
    display: flex;
}

.thankyou-card {
    background: #ffffff;
    border-radius: var(--radius-lg);
    padding: 56px 48px;
    max-width: 520px;
    width: 100%;
    text-align: center;
    box-shadow: 0 40px 100px -20px rgba(15, 23, 42, 0.25);
    border: 1px solid var(--border);
}

.modal-sheet {
    text-align: left;
    padding: 30px;
}

.modal-scroll {
    max-height: 90vh;
    overflow-y: auto;
}

.modal-heading {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 20px;
}

.modal-block {
    margin-bottom: 20px;
}

.modal-block-sm {
    margin-bottom: 15px;
}

.modal-block-lg {
    margin-bottom: 25px;
}

.modal-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 8px;
}

.modal-label-sm {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 4px;
}

.modal-plain-textarea {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    resize: none;
    min-height: 80px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn-muted {
    background: #e2e8f0;
    color: #475569;
    width: auto;
    padding: 10px 20px;
    font-size: 14px;
}

.btn-violet {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    padding: 10px 20px;
}

.btn-success-inline {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    width: auto;
    padding: 10px 20px;
}

.preview-box {
    padding: 12px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.preview-title {
    font-weight: 600;
    color: #0f172a;
}

.preview-desc {
    color: #334155;
    white-space: pre-wrap;
    font-size: 14px;
    min-height: 100px;
}

.thankyou-card.modal-compact {
    max-width: 450px;
}

.thankyou-card.modal-wide {
    max-width: 680px;
}

.thankyou-card .icon-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #ecfdf5;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 32px;
    color: var(--success);
    font-size: 32px;
}

.thankyou-card h2 {
    font-size: 28px;
    font-weight: 900;
    color: var(--primary);
    margin-bottom: 8px;
    letter-spacing: -1px;
}

.thankyou-card .body-text {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.8;
    margin-bottom: 40px;
    background: #f8fafc;
    padding: 24px;
    border-radius: var(--radius-md);
    text-align: left;
    border-left: 4px solid var(--primary);
}

.thankyou-card .close-btn {
    padding: 14px 40px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-capsule);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.thankyou-card .close-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

/* ── Footer ── */
.form-footer {
    text-align: center;
    padding: 32px 48px;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    background: #f8fafc;
    border-top: 1px solid var(--border);
}

/* ── History Sidebar ── */
.history-glass-card {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    height: 100%;
    position: sticky;
    top: 32px;
    overflow: hidden;
}

.history-header {
    padding: 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.history-id {
    font-size: 11px;
    color: var(--primary);
    font-family: monospace;
    margin-top: 4px;
}

.history-header i {
    color: var(--primary);
    font-size: 18px;
}

.history-header h3 {
    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    max-height: 600px;
}

.history-item {
    padding: 18px 24px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: var(--transition);
}

.history-item:hover {
    background: rgba(0, 74, 173, 0.03);
}

.history-title {
    font-weight: 700;
    font-size: 14px;
    color: var(--primary-dark);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-date {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.history-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.status-badge {
    font-size: 10px;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 12px;
    text-transform: uppercase;
}

.status-badge.pending {
    background: #fff7ed;
    color: #ea580c;
}

.status-badge.completed {
    background: #ecfdf5;
    color: #059669;
}

.edit-btn-inline {
    background: var(--primary-soft);
    border: 1px solid var(--border);
    color: var(--primary);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.edit-btn-inline:hover {
    background: var(--primary);
    color: #fff;
    transform: scale(1.1);
}

.history-loading,
.history-empty,
.history-error {
    padding: 40px 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.history-footer {
    padding: 16px 24px;
    background: rgba(0, 0, 0, 0.02);
    border-top: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
}

@media(max-width: 1024px) {
    .split-layout {
        flex-direction: column;
    }

    .history-column {
        min-width: 100%;
    }
}

@media(max-width: 768px) {
    body {
        padding: 20px 15px;
    }

    .container {
        border-radius: var(--radius-md);
    }

    .premium-header {
        padding: 16px 24px;
        flex-wrap: wrap;
        gap: 12px;
    }

    .header-center-block {
        text-align: left;
    }

    .display-title {
        font-size: 28px;
    }

    form {
        padding: 24px 16px;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .form-section-title-split {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .modal-actions {
        flex-wrap: wrap;
    }

    .row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .thankyou-card {
        padding: 40px 24px;
    }

    .thankyou-card.modal-wide,
    .thankyou-card.modal-compact {
        max-width: 100%;
    }
}
