/* CSS Variables - Green Theme (matching Chambers apps) */
:root {
    --color-primary-dark: #14532D;
    --color-primary: #1B4D3E;
    --color-primary-light: #40916C;
    --color-accent: #10b981;
    --color-accent-light: #34d399;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-text: #1f2937;
    --color-text-light: #6b7280;
    --color-text-muted: #9ca3af;
    --color-bg: #f8fafc;
    --color-bg-white: #ffffff;
    --color-border: #e5e7eb;
    --color-border-light: #f3f4f6;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
}

/* Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Base */
html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    color: var(--color-text);
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }

p { margin-bottom: 1rem; }

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover {
    color: var(--color-primary-light);
    text-decoration: underline;
}

/* Utility Classes */
.hidden { display: none !important; }

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--color-bg-white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    max-width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

/* Auth Modal */
.auth-modal {
    width: 420px;
    padding: 2rem;
}

.auth-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.auth-header h2 {
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

.auth-header p {
    color: var(--color-text-light);
    font-size: 0.9rem;
    margin-bottom: 0;
}

.auth-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    background: var(--color-bg);
    padding: 4px;
    border-radius: var(--radius-md);
}

.auth-tab {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-text-light);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.auth-tab:hover {
    color: var(--color-text);
}

.auth-tab.active {
    background: var(--color-bg-white);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.auth-error {
    color: var(--color-danger);
    font-size: 0.85rem;
    text-align: center;
    margin-top: 1rem;
    min-height: 1.2rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

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

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-light);
}

.btn-secondary {
    background: var(--color-border);
    color: var(--color-text);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--color-border-light);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.btn-outline:hover:not(:disabled) {
    background: var(--color-bg);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 1rem 1.5rem;
    font-size: 1rem;
}

.btn-full {
    width: 100%;
}

/* Form Elements */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 0.4rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 0.95rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-white);
    color: var(--color-text);
    transition: all 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(27, 77, 62, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--color-text-muted);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-section-title {
    font-size: 1rem;
    color: var(--color-primary);
    margin: 1.5rem 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

.form-card {
    background: var(--color-bg-white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--color-border);
}

/* App Container */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: var(--color-bg-white);
    border-bottom: 1px solid var(--color-border);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--color-primary);
}

.logo svg {
    color: var(--color-accent);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-email {
    font-size: 0.85rem;
    color: var(--color-text-light);
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

/* Steps */
.step {
    display: none;
}

.step.active {
    display: block;
    opacity: 1;
}

.step-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.step-number {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    color: white;
    font-weight: 600;
    border-radius: 50%;
    font-size: 1rem;
}

.step-header h2 {
    margin: 0;
    color: #1f2937;
    font-weight: 600;
}

/* Document Type Cards */
.document-types {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

@media (max-width: 700px) {
    .document-types {
        grid-template-columns: 1fr;
    }
}

.doc-type-card {
    background: var(--color-bg-white);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.doc-type-card:hover {
    border-color: var(--color-primary-light);
    box-shadow: var(--shadow-md);
}

.doc-type-card.selected {
    border-color: var(--color-primary);
    background: rgba(27, 77, 62, 0.05);
}

.doc-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #dcfce7;
    border-radius: var(--radius-md);
    color: #166534;
}

.doc-icon svg {
    stroke: #166534;
}

.doc-type-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #14532d;
    font-weight: 600;
}

.doc-type-card p {
    font-size: 0.875rem;
    color: #4b5563;
    margin: 0;
    line-height: 1.5;
}

/* LBN Type Fields */
.lbn-type-fields {
    margin-top: 1.5rem;
}

.lbn-type-content {
    margin-top: 0;
}

/* Deadline Row */
.deadline-row {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--color-border-light);
}

.deadline-row:last-child {
    border-bottom: none;
}

.deadline-row .form-row {
    grid-template-columns: 2fr 2fr 1fr;
}

@media (max-width: 700px) {
    .deadline-row .form-row {
        grid-template-columns: 1fr;
    }
}

/* Preview */
.preview-container {
    background: var(--color-bg-white);
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}

.preview-header h3 {
    margin: 0;
    font-size: 1rem;
}

.preview-content {
    padding: 2rem;
    max-height: 500px;
    overflow-y: auto;
    font-family: 'Century Gothic', 'Helvetica Neue', Arial, sans-serif;
    font-size: 12pt;
    line-height: 1.5;
}

/* LBN Preview Styles */
.preview-content .lbn-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.preview-content .lbn-title {
    font-size: 14pt;
    font-weight: bold;
    margin-bottom: 1rem;
}

.preview-content .lbn-meta {
    text-align: left;
    margin-bottom: 1.5rem;
}

.preview-content .lbn-meta-row {
    margin-bottom: 0.25rem;
}

.preview-content .lbn-meta-label {
    font-weight: bold;
    display: inline;
}

.preview-content .lbn-section {
    margin-top: 1.5rem;
}

.preview-content .lbn-section-title {
    font-size: 14pt;
    font-weight: bold;
    margin-bottom: 0.75rem;
}

.preview-content .lbn-subsection-title {
    font-size: 12pt;
    font-weight: bold;
    font-style: italic;
    margin: 1rem 0 0.5rem;
}

.preview-content .lbn-paragraph {
    margin-bottom: 0.75rem;
    text-align: justify;
}

.preview-content .lbn-list {
    margin-left: 1.5rem;
    margin-bottom: 0.75rem;
}

.preview-content .lbn-list-item {
    margin-bottom: 0.25rem;
}

.preview-content .lbn-deadline {
    margin-bottom: 0.5rem;
}

.preview-content .lbn-deadline-task {
    font-weight: bold;
}

.preview-content .lbn-qa {
    margin-bottom: 0.75rem;
}

.preview-content .lbn-qa-q {
    font-weight: bold;
}

.preview-content .lbn-footer {
    margin-top: 2rem;
    text-align: right;
}

.preview-content .lbn-sign-name {
    font-weight: bold;
}

/* Download Options */
.download-options {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.download-options .btn {
    flex: 1;
    min-width: 200px;
}

/* Footer */
.footer {
    background: var(--color-bg-white);
    border-top: 1px solid var(--color-border);
    padding: 1.5rem 2rem;
    text-align: center;
}

.footer p {
    font-size: 0.85rem;
    color: var(--color-text-light);
    margin: 0.25rem 0;
}

.footer a {
    color: var(--color-primary);
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        padding: 1rem;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .main-content {
        padding: 1rem;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions .btn {
        width: 100%;
    }

    .download-options {
        flex-direction: column;
    }

    .download-options .btn {
        width: 100%;
    }
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--color-text);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    animation: slideIn 0.3s ease;
}

.toast.success {
    background: var(--color-success);
}

.toast.error {
    background: var(--color-danger);
}

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