/* ==========================================================================
   Bodó Ügyvédi Iroda - Ajánlat Generátor
   Professional, clean styling for law firm email generator
   Two-column responsive layout (40/60 split - form/preview)
   ========================================================================== */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #f0f2f5;
    color: #333;
    line-height: 1.6;
}

/* ==========================================================================
   Login Screen Styles
   ========================================================================== */

.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3d4f5f 0%, #2c3e50 100%);
    padding: 20px;
}

.login-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    width: 100%;
    max-width: 400px;
}

.login-header {
    background: linear-gradient(135deg, #2c3e50 0%, #1a252f 100%);
    color: white;
    padding: 40px 30px;
    text-align: center;
}

.login-header h1 {
    font-size: 1.8rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.login-header .subtitle {
    font-size: 1rem;
    opacity: 0.85;
    font-weight: 300;
}

.login-form {
    padding: 40px 30px;
}

.login-form .form-group {
    margin-bottom: 24px;
}

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

.login-form .form-group input {
    width: 100%;
    padding: 12px 14px;
    font-size: 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    background-color: #fafafa;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-form .form-group input:focus {
    outline: none;
    border-color: #3d4f5f;
    box-shadow: 0 0 0 3px rgba(61, 79, 95, 0.15);
    background-color: white;
}

.login-btn {
    width: 100%;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    margin-top: 8px;
}

.login-error {
    background-color: #f8d7da;
    color: #721c24;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 500;
    border: 1px solid #f5c6cb;
}

/* ==========================================================================
   Main Application Styles
   ========================================================================== */

/* App Container - No height restrictions, natural flow */
.app-container {
    max-width: 1800px;
    margin: 0 auto;
    padding: 20px;
}

/* App Header */
.app-header {
    text-align: center;
    padding: 24px 20px;
    background: linear-gradient(135deg, #3d4f5f 0%, #2c3e50 100%);
    color: white;
    border-radius: 8px 8px 0 0;
    margin-bottom: 0;
}

.app-header h1 {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.app-header .subtitle {
    font-size: 0.95rem;
    opacity: 0.9;
    font-weight: 300;
}

/* Main Content - Two Column Layout (natural height) */
.main-content {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 0;
    background: white;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    align-items: start;
}

/* Form Section - Left Column (no scroll, full height) */
.form-section {
    padding: 24px;
    border-right: 1px solid #e0e0e0;
    background-color: #fafbfc;
}

/* Preview Section - Right Column (no scroll, content grows) */
.preview-section {
    padding: 24px;
    display: flex;
    flex-direction: column;
    background-color: #f0f2f5;
}

/* Section Headers */
.form-section h2,
.preview-section h2 {
    font-size: 1.15rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #3d4f5f;
}

/* Form Styles */
.form-group {
    margin-bottom: 14px;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 10px;
    font-size: 0.9rem;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    background-color: #ffffff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3d4f5f;
    box-shadow: 0 0 0 3px rgba(61, 79, 95, 0.1);
    background-color: white;
}

.form-group select {
    cursor: pointer;
}

/* Form Section Title */
.form-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    margin: 20px 0 12px 0;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

/* Hidden class for dynamic form fields */
.hidden {
    display: none !important;
}

/* View Toggle Tabs */
.view-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    border-bottom: 2px solid #dde1e6;
    background-color: white;
    border-radius: 6px 6px 0 0;
    padding: 0 4px;
}

.tab-btn {
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    background: transparent;
    color: #666;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}

.tab-btn:hover {
    color: #3d4f5f;
}

.tab-btn.active {
    color: #3d4f5f;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: #3d4f5f;
}

/* Preview Container - Full width */
.preview-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Email Preview - Full width with shadow */
.email-preview {
    background-color: #e8eaed;
    border-radius: 6px;
    padding: 24px;
}

/* The actual email content wrapper - full width */
.email-preview > table {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    width: 100% !important;
    max-width: 100% !important;
}

/* HTML Container */
.html-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.html-container textarea {
    flex: 1;
    width: 100%;
    min-height: 400px;
    padding: 14px;
    font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
    font-size: 0.8rem;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    background-color: #ffffff;
    resize: vertical;
    line-height: 1.5;
}

/* Copy Buttons */
.copy-buttons {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-shrink: 0;
}

.copy-buttons .btn-primary,
.copy-buttons .btn-secondary {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-icon {
    font-size: 1rem;
}

/* Buttons */
.btn-primary,
.btn-secondary {
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

.btn-primary {
    background-color: #3d4f5f;
    color: white;
}

.btn-primary:hover {
    background-color: #2c3e50;
}

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

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

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

/* Generate Button in Form */
.form-section .btn-primary {
    width: 100%;
    margin-top: 8px;
}

/* Copy Feedback */
.copy-feedback {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 4px;
    font-weight: 500;
    text-align: center;
    font-size: 0.9rem;
    opacity: 0;
    transition: opacity 0.3s;
    flex-shrink: 0;
}

.copy-feedback.show {
    opacity: 1;
}

.copy-feedback.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.copy-feedback.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* App Footer */
.app-footer {
    text-align: center;
    padding: 16px;
    margin-top: 16px;
    color: #666;
    font-size: 0.85rem;
}

.footer-contact {
    margin-top: 4px;
    font-size: 0.8rem;
    color: #888;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 350px 1fr;
    }
}

@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }

    .form-section {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: 10px;
    }

    .app-header {
        padding: 16px 12px;
    }

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

    .form-section,
    .preview-section {
        padding: 16px;
    }

    .copy-buttons {
        flex-direction: column;
    }

    .copy-buttons .btn-primary,
    .copy-buttons .btn-secondary {
        width: 100%;
    }

    .view-toggle {
        flex-wrap: wrap;
    }

    .tab-btn {
        flex: 1;
        text-align: center;
    }

    .email-preview {
        padding: 10px;
    }

    /* Login responsive */
    .login-container {
        max-width: 100%;
    }

    .login-header {
        padding: 30px 20px;
    }

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

    .login-form {
        padding: 30px 20px;
    }
}

@media (max-width: 480px) {
    .form-section h2,
    .preview-section h2 {
        font-size: 1rem;
    }

    .form-group input,
    .form-group select {
        padding: 8px 10px;
        font-size: 0.85rem;
    }

    .btn-primary,
    .btn-secondary {
        padding: 10px 14px;
        font-size: 0.85rem;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .login-screen,
    .form-section,
    .html-container,
    .copy-buttons,
    .app-footer,
    .view-toggle {
        display: none;
    }

    .main-content {
        display: block;
    }

    .preview-section {
        padding: 0;
        background: white;
    }

    .email-preview {
        background: white;
        padding: 0;
    }
}
