:root {
    --primary-teal: #002B36;
    --primary-lime: #BED600;
    --bg-main: #F4F7F6;
    --border-color: rgba(226, 232, 240, 0.6);
    --text-main: #1E293B;
    --text-muted: #64748B;
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.4);
    --shadow-soft: 0 20px 40px -10px rgba(0, 43, 54, 0.08);
    --shadow-hover: 0 30px 60px -15px rgba(0, 43, 54, 0.15);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    /* Soft gradient mesh background */
    background: radial-gradient(circle at 15% 50%, rgba(190, 214, 0, 0.12), transparent 40%),
                radial-gradient(circle at 85% 30%, rgba(0, 43, 54, 0.08), transparent 40%),
                var(--bg-main);
    background-attachment: fixed;
    color: var(--text-main);
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* Gradient Accent bar */
.accent-bar {
    height: 6px;
    background: linear-gradient(90deg, var(--primary-teal) 0%, var(--primary-lime) 100%);
    width: 100%;
    flex-shrink: 0;
}

/* Topbar with glass effect */
.topbar {
    background-color: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1.75rem 0;
    width: 100%;
    flex-shrink: 0;
    z-index: 10;
}

.topbar-content {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.cqu-image-logo {
    height: 64px; /* Perfectly scales the logo to fit the top bar */
    width: auto;
    display: block;
}

.app-title {
    font-size: 1.6rem;
    font-weight: 500;
    color: var(--text-muted);
    border-left: 2px solid var(--border-color);
    padding-left: 1.5rem;
    margin-left: 0.5rem;
}

.content-wrapper {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1.5rem 0;
}

/* Glassmorphism Main Container */
.container {
    width: 95%;
    max-width: 1250px;
    padding: 3.5rem;
    border-radius: 24px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-soft);
}

header {
    margin-bottom: 2.5rem;
    text-align: left;
}

header h1 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-teal);
    margin-bottom: 0.75rem;
    letter-spacing: -0.5px;
}

header p {
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.6;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3.5rem;
}

@media (min-width: 1000px) {
    .dashboard-grid {
        grid-template-columns: 1.2fr 1fr;
    }
}

.left-panel, .right-panel {
    display: flex;
    flex-direction: column;
}

.right-panel {
    background: rgba(248, 250, 252, 0.6);
    padding: 2.5rem;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

.template-selector h2, .upload-sections h2 {
    font-size: 1.2rem;
    color: var(--primary-teal);
    margin-bottom: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.template-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 1.75rem;
}

.template-card {
    background: #FFFFFF;
    border: 2px solid transparent;
    border-radius: 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 4px 15px -3px rgba(0, 0, 0, 0.05);
    position: relative;
}

.template-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
    pointer-events: none;
}

.template-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
}

.template-card.active {
    background: #FFFFFF;
}

.template-card.active::after {
    border-color: var(--primary-lime);
}

.template-thumbnail {
    width: 100%;
    aspect-ratio: 1 / 1.3;
    object-fit: contain;
    padding: 1.2rem;
    border-bottom: 1px solid var(--border-color);
    background-color: #FFFFFF;
    transition: transform 0.3s ease;
}

.template-card:hover .template-thumbnail {
    transform: scale(1.03);
}

.template-icon {
    font-size: 2.5rem;
    margin: auto;
    transition: transform 0.3s ease;
}

.template-card:hover .template-icon {
    transform: scale(1.1) rotate(5deg);
}

.template-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary-teal);
    padding: 1rem 0.5rem;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FFFFFF;
    z-index: 1;
}

.upload-sections {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.drop-zone {
    border: 2px dashed #CBD5E1;
    border-radius: 16px;
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    background: #FFFFFF;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.drop-zone::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--primary-lime);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.drop-zone:hover {
    border-color: var(--primary-teal);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -5px rgba(0, 43, 54, 0.05);
}

.drop-zone.dragover {
    border-color: var(--primary-lime);
}

.drop-zone.dragover::before {
    opacity: 0.05;
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    position: relative;
    z-index: 1;
}

.upload-icon {
    color: var(--primary-teal);
    margin-bottom: 1rem;
    width: 32px; height: 32px;
    transition: transform 0.3s ease;
}

.drop-zone:hover .upload-icon {
    transform: translateY(-3px);
}

.drop-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--primary-teal);
    margin-bottom: 0.35rem;
}

.drop-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.file-list {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.file-item {
    background: #FFFFFF;
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-main);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.file-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    font-weight: 500;
}

.meta-input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    background: #FFFFFF;
    transition: border-color 0.2s;
    font-family: inherit;
}
.meta-input:focus {
    outline: none;
    border-color: var(--primary-teal);
    box-shadow: 0 0 0 3px rgba(0, 43, 54, 0.1);
}

.metadata-section h2 {
    font-size: 1.2rem;
    color: var(--primary-teal);
    margin-bottom: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.delete-icon {
    color: #94A3B8;
    cursor: pointer;
    font-size: 1.1rem;
    font-weight: bold;
    padding: 0 6px;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.delete-icon:hover {
    color: #EF4444;
    background: #FEE2E2;
}

button {
    width: 100%;
    padding: 1.1rem;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary-teal) 0%, #001A22 100%);
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 10px 20px -5px rgba(0, 43, 54, 0.3);
    letter-spacing: 0.5px;
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -5px rgba(0, 43, 54, 0.4);
}

button:active:not(:disabled) {
    transform: translateY(1px);
}

button:disabled {
    background: #E2E8F0;
    color: #94A3B8;
    cursor: not-allowed;
    box-shadow: none;
}

.spinner {
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top: 3px solid white;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.status-message {
    margin-top: 1.25rem;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
    min-height: 20px;
}

.status-success { color: #059669; }
.status-error { color: #DC2626; }

footer {
    background-color: var(--primary-teal);
    color: #FFFFFF;
    padding: 2rem 0;
    width: 100%;
    margin-top: auto;
    flex-shrink: 0;
}

.footer-content {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    font-size: 0.9rem;
    line-height: 1.8;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    opacity: 0.9;
}

.footer-content strong {
    color: var(--primary-lime);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.footer-content a {
    color: var(--primary-lime);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 2px solid transparent;
    transition: border-color 0.2s;
}

.footer-content a:hover {
    border-color: var(--primary-lime);
}
