:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --bg-color: #0f172a;
    --card-bg: #1e293b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

#aag-form-container {
    max-width: 1000px;
    margin: 40px auto;
    padding: 40px;
    background: var(--bg-color);
    border-radius: 24px;
    font-family: 'Inter', -apple-system, sans-serif;
    color: var(--text-main);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.aag-header {
    text-align: center;
    margin-bottom: 40px;
}

.aag-header h2 {
    font-size: 36px;
    font-weight: 800;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 12px;
}

.aag-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.aag-section {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    margin-bottom: 30px;
}

.aag-section h3 {
    margin-top: 0;
    margin-bottom: 24px;
    font-size: 20px;
    font-weight: 700;
    color: #818cf8;
    display: flex;
    align-items: center;
    gap: 10px;
}

.aag-field {
    margin-bottom: 20px;
}

.aag-field label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-muted);
}

.aag-field input, 
.aag-field select {
    width: 100%;
    padding: 12px 16px;
    background: #0f172a;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 15px;
    color: white;
    transition: all 0.3s;
}

.aag-field input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
    outline: none;
}

#aag-submit-btn {
    background: linear-gradient(to right, #6366f1, #a855f7);
    color: white;
    padding: 16px;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    font-size: 18px;
    font-weight: 700;
    width: 100%;
    transition: transform 0.2s, opacity 0.2s;
    margin-top: 10px;
}

#aag-submit-btn:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

/* Page-based Display */
#aag-output-content {
    background: #f1f5f9; /* Light grey background for the "viewer" */
    padding: 40px 20px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    max-height: 800px;
    overflow-y: auto;
}

/* Individual Page Style */
.aag-page {
    background: white;
    width: 210mm; /* A4 Width */
    min-height: 297mm; /* A4 Height */
    padding: 20mm;
    margin: 0 auto;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    color: #1e293b;
    position: relative;
    box-sizing: border-box;
    overflow: hidden;
}

.aag-page-number {
    position: absolute;
    bottom: 10mm;
    right: 10mm;
    font-size: 12px;
    color: #64748b;
}

.aag-actions {
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

.aag-actions button {
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: white;
    transition: all 0.2s;
}

.aag-actions button:hover {
    background: var(--border-color);
}

#aag-loading {
    text-align: center;
    padding: 80px;
}

.spinner {
    border: 4px solid rgba(255,255,255,0.1);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

@media (max-width: 1000px) {
    .aag-page {
        width: 95%;
        min-height: auto;
        padding: 10mm;
    }
    .aag-grid {
        grid-template-columns: 1fr;
    }
}
