* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
}

/* Mobile/Tablet Warning Screen */
.mobile-warning {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.mobile-warning.show {
    display: flex;
}

.mobile-warning-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.mobile-warning-icon {
    font-size: 64px;
    margin-bottom: 20px;
    display: block;
}

.mobile-warning-title {
    color: #333;
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 15px;
}

.mobile-warning-message {
    color: #666;
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.mobile-warning-features {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    text-align: left;
}

.mobile-warning-features h4 {
    color: #333;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    text-align: center;
}

.mobile-warning-features ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-warning-features li {
    color: #555;
    font-size: 13px;
    margin: 5px 0;
    padding-left: 20px;
    position: relative;
}

.mobile-warning-features li:before {
    content: "•";
    color: #4285f4;
    font-weight: bold;
    position: absolute;
    left: 0;
}

@media (min-width: 1024px) {
    .mobile-warning {
        display: none !important;
    }
}

.container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 40px;
    max-width: 1000px !important;
    width: 95%;
    text-align: center;
    transition: transform 0.3s ease;
}

.container:hover {
    transform: translateY(-5px);
}

.logo {
    width: 200px;
    height: 200px;
    margin: 0 auto 20px;
    border-radius: 10px;
    overflow: hidden;
}

.logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

h1 {
    color: #333;
    margin-bottom: 10px;
    font-size: 2.2em;
    font-weight: 300;
}

.subtitle {
    color: #666;
    margin-bottom: 30px;
    font-size: 1.1em;
}

.login-section {
    margin: 30px 0;
}

.google-btn {
    background: #4285f4;
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(66, 133, 244, 0.3);
}

.google-btn:hover {
    background: #3367d6;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(66, 133, 244, 0.4);
}

.google-icon {
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4285f4;
    font-weight: bold;
}

.user-info {
    display: none;
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    border-left: 4px solid #4285f4;
}

.user-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin: 0 auto 15px;
    display: block;
}

.email-tool {
    display: none;
    margin-top: 30px;
    text-align: left;
}

.info-box {
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
    border: 2px solid #4285f4;
    border-radius: 15px;
    padding: 20px;
    margin: 20px 0;
    position: relative;
    box-shadow: 0 4px 15px rgba(66, 133, 244, 0.1);
}

.template-info {
    border-color: #4285f4;
    background: linear-gradient(135deg, #e3f2fd 0%, #f0f4ff 100%);
}

.info-box .info-icon {
    font-size: 24px;
    margin-right: 15px;
    float: left;
}

.info-box .info-content {
    overflow: hidden;
}

.info-box h4 {
    color: #1976d2;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.info-box p {
    color: #424242;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 8px;
}

.info-box code {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 2px 6px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    color: #d32f2f;
}

.format-badges {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.badge-supported {
    background: #4caf50;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-deprecated {
    background: #f44336;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.email-form {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 25px;
    margin-top: 20px;
}

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

.form-group {
    margin-bottom: 20px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 14px;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #4285f4;
}

/* [UPDATED] Editor Styles for Quill.js */
.editor-container {
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    overflow: hidden;
    transition: border-color 0.3s ease;
    background: #fff; /* Add background for consistency */
}

/* Add focused state for the whole container */
.editor-container.focused,
.editor-container:has(.ql-container.ql-snow.ql-focused) {
    border-color: #4285f4;
}

.editor-toolbar {
    background: #f8f9fa;
    border-bottom: 1px solid #e1e5e9;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.editor-toggle {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.editor-toggle.active {
    background: #4285f4;
    color: white;
    border-color: #4285f4;
}

.expand-btn {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-left: auto; /* Pushes button to the far right */
}

.expand-btn:hover {
    background: #f0f0f0;
    border-color: #999;
}

/* Quill Editor Specific Styles */
#quillEditorContainer {
    background-color: white;
}

.ql-toolbar.ql-snow {
    border: none;
    border-bottom: 1px solid #e1e5e9;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
    padding: 10px;
}

.ql-container.ql-snow {
    border: none;
}

.ql-editor {
    min-height: 400px;
    font-size: 14px;
    line-height: 1.6;
    background: white;
    text-align: center; /* Center align email template previews */
}

.ql-editor.ql-blank::before {
    font-style: normal;
    font-size: 14px;
    color: #999;
    left: 20px; /* Align placeholder with padding */
}

/* Crucial for ensuring pasted email templates center correctly */
.ql-editor .container,
.ql-editor div[class*="container"],
.ql-editor table,
.ql-editor .center,
.ql-editor [align="center"],
.ql-editor [style*="text-align: center"],
.ql-editor [style*="margin: 0 auto"],
.ql-editor [style*="margin:0 auto"] {
    margin-left: auto !important;
    margin-right: auto !important;
    text-align: center !important;
    /* Reset other properties that might interfere */
    max-width: none !important;
    width: auto !important;
    box-shadow: none !important;
    border-radius: 0 !important;
}

/* Plain Textarea style */
.plain-text-editor {
    width: 100%;
    min-height: 450px; /* Match Quill's default height including toolbar */
    padding: 15px 20px;
    border: none;
    font-family: 'Courier New', Consolas, Monaco, monospace;
    font-size: 13px;
    line-height: 1.5;
    outline: none;
    resize: vertical;
    background: white;
    box-sizing: border-box;
}

.file-upload {
    position: relative;
    display: inline-block;
    width: 100%;
}

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

.file-upload-label {
    display: block;
    padding: 12px 15px;
    background: #fff;
    border: 2px dashed #e1e5e9;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #666;
}

.file-upload-label:hover {
    border-color: #4285f4;
    background: #f8f9fa;
}

.file-upload.has-file .file-upload-label {
    border-color: #28a745;
    background: #d4edda;
    color: #155724;
}

.file-info {
    margin-top: 8px;
    font-size: 12px;
    color: #666;
}

.send-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
}

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

.error-message {
    background: #fee;
    color: #c33;
    padding: 15px;
    border-radius: 10px;
    margin: 20px 0;
    border-left: 4px solid #c33;
    display: none;
}

.success-message {
    background: #efe;
    color: #3c3;
    padding: 15px;
    border-radius: 10px;
    margin: 20px 0;
    border-left: 4px solid #3c3;
    display: none;
}

.logout-btn {
    background: transparent;
    color: #666;
    border: 2px solid #ddd;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    margin-top: 15px;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    border-color: #999;
    color: #333;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal {
    background: white;
    border-radius: 20px;
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    position: relative;
}

.results-modal {
    max-width: 800px;
}

.modal-overlay.show {
    display: flex;
}

.modal-overlay.show .modal {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 5px;
    line-height: 1;
}

.modal-close:hover {
    color: #333;
}

.modal-header {
    text-align: center;
    margin-bottom: 25px;
}

.modal-title {
    color: #333;
    font-size: 1.4em;
    font-weight: 600;
    margin-bottom: 10px;
}

.modal-subtitle {
    color: #666;
    font-size: 1em;
    margin-bottom: 20px;
}

.template-validation {
    margin: 20px 0;
    border-radius: 10px;
    overflow: hidden;
}

.validation-issues,
.validation-warnings,
.validation-success {
    margin-bottom: 10px;
}

.validation-header {
    padding: 12px 15px;
    font-weight: 600;
    font-size: 14px;
    border-radius: 8px 8px 0 0;
}

.validation-header.error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.validation-header.warning { background: #fff3cd; color: #856404; border: 1px solid #ffeaa7; }
.validation-header.success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }

.validation-item {
    padding: 8px 15px;
    font-size: 13px;
    border-left: 1px solid;
    border-right: 1px solid;
}

.validation-item.error { background: #fefefe; border-color: #f5c6cb; color: #721c24; }
.validation-item.warning { background: #fefefe; border-color: #ffeaa7; color: #856404; }
.validation-item.success { background: #fefefe; border-color: #c3e6cb; color: #155724; }
.validation-item:last-child { border-bottom: 1px solid; border-radius: 0 0 8px 8px; }

.email-list {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin: 20px 0;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e1e5e9;
}

.email-item {
    padding: 8px 12px;
    margin: 4px 0;
    background: white;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: #555;
    border-left: 3px solid #4285f4;
}

.more-indicator {
    padding: 8px 12px;
    margin: 4px 0;
    background: #fff3cd;
    border-radius: 6px;
    font-style: italic;
    color: #856404;
    border-left: 3px solid #ffc107;
    text-align: center;
}

.modal-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.modal-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-btn.single { flex: none; width: 100%; }
.modal-btn.confirm { background: linear-gradient(45deg, #28a745, #20c997); color: white; }
.modal-btn.confirm:hover { background: linear-gradient(45deg, #218838, #1aa179); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(40, 167, 69, 0.3); }
.modal-btn.cancel { background: #6c757d; color: white; }
.modal-btn.cancel:hover { background: #5a6268; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(108, 117, 125, 0.3); }

/* [UPDATED] Fullscreen Editor Styles */
.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #f8f9fa; /* Lighter background for fullscreen */
    z-index: 2000;
    display: none;
    flex-direction: column;
}

.fullscreen-overlay.show { display: flex; }

.fullscreen-header {
    background: #e9ecef;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #dee2e6;
}

.fullscreen-title {
    color: #333;
    font-size: 16px;
    font-weight: 500;
    margin: 0;
}

.fullscreen-editor-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #fff;
}

.fullscreen-toolbar {
    background: #f8f9fa;
    border-bottom: 1px solid #e1e5e9;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.fullscreen-toggle {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    color: #333;
}

.fullscreen-toggle.active {
    background: #4285f4;
    color: white;
    border-color: #4285f4;
}

.fullscreen-close-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.fullscreen-close-btn:hover { background: #c82333; transform: translateY(-1px); }

#fullscreenQuillEditorContainer {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}
#fullscreenQuillEditorContainer .ql-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
#fullscreenQuillEditorContainer .ql-editor {
    min-height: 0; /* No min-height needed */
    height: 100%;
}

.fullscreen-plain-text-editor {
    flex: 1;
    padding: 20px 25px;
    border: none;
    font-family: 'Courier New', Consolas, Monaco, monospace;
    font-size: 13px;
    line-height: 1.5;
    outline: none;
    resize: none;
    background: white;
    box-sizing: border-box;
}

/* Responsive Design */
@media (max-width: 1023px) {
    .container {
        display: none !important;
    }
}

@media (max-width: 900px) {
    h1 { font-size: 1.8em; }
    .form-row { grid-template-columns: 1fr; gap: 15px; }
    .modal { padding: 20px; width: 95%; max-width: 500px; }
    .results-modal { max-width: 95%; }
    .modal-actions { flex-direction: column; }
    .expand-btn { display: none; }
    .fullscreen-header { padding: 10px 15px; }
    .fullscreen-toolbar { padding: 8px 12px; flex-wrap: wrap; }
}