/*
 * Invoice Generator styles.
 *
 * Extracted from templates/invoice-generator-template.php, where this used to
 * be an inline <style> block re-sent on every page view. Now enqueued, so
 * browsers cache it.
 */
        .invoice-generator-app * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        .invoice-generator-app {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: transparent;
            min-height: 100vh;
            padding: 20px;
            overflow-x: hidden;
        }

        .invoice-generator-app .container {
            max-width: 1600px;
            margin: 0 auto;
            overflow: hidden;
        }

        .invoice-generator-app .header {
            text-align: center;
            color: #1f2937;
            margin-bottom: 40px;
            padding: 20px;
        }

        .invoice-generator-app .header h2 {
            font-size: 2.5em;
            margin-bottom: 10px;
            color: #1a5f3f;
        }

        .invoice-generator-app .header p {
            font-size: 1.2em;
            color: #4b5563;
        }

        /* Template Selection View */
        /* Editor View */
        .invoice-generator-app .editor-view {
            display: flex;
            flex-direction: column;
            background: #f5f7f5;
            border-radius: 10px;
            box-shadow: 0 4px 24px rgba(26,95,63,0.08);
            border: 1px solid #d1d5db;
            overflow: hidden;
        }

        /* ── Mobile tab toggle (hidden on desktop) ── */
        .invoice-generator-app .mobile-tab-toggle {
            display: none;
        }

        .invoice-generator-app .tab-btn {
            background: rgba(255,255,255,0.15);
            color: white;
            border: 1.5px solid rgba(255,255,255,0.4);
            padding: 6px 16px;
            border-radius: 20px;
            font-size: 0.82em;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
        }

        .invoice-generator-app .tab-btn.active {
            background: white;
            color: #1a5f3f;
            border-color: white;
        }

        .invoice-generator-app .editor-header {
            background: #1a5f3f;
            color: white;
            padding: 14px 24px 12px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 8px;
        }

        .invoice-generator-app .editor-header-left {
            display: flex;
            flex-direction: column;
            gap: 6px;
        }

        .invoice-generator-app .editor-header h2 {
            font-size: 1.2em;
            font-weight: 700;
            margin: 0;
            color: white;
        }

        .invoice-generator-app .header-badges {
            display: flex;
            gap: 6px;
            flex-wrap: wrap;
        }

        .invoice-generator-app .header-badge {
            display: inline-flex;
            align-items: center;
            background: transparent;
            border: 1.5px solid rgba(255,255,255,0.55);
            color: rgba(255,255,255,0.88);
            font-size: 0.7em;
            font-weight: 500;
            padding: 2px 9px;
            border-radius: 20px;
            white-space: nowrap;
        }
        .invoice-generator-app .editor-content {
            display: grid;
            grid-template-columns: 400px 1fr;
            gap: 0;
        }

        /* Preview column = toolbar + beige preview area stacked */
        .invoice-generator-app .preview-column {
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        .invoice-generator-app .editor-sidebar {
            background: #ffffff;
            padding: 30px;
            overflow-y: auto;
            max-height: calc(100vh - 200px);
            border-right: 1px solid #e2e8f0;
        }

        .invoice-generator-app .editor-preview {
            padding: 30px;
            background: #eef2ee;
            overflow-y: auto;
            max-height: calc(100vh - 200px);
        }

        /* ── Mobile: tab-based switching ── */
        @media (max-width: 900px) {
            .invoice-generator-app .mobile-tab-toggle {
                display: flex;
                gap: 8px;
            }

            .invoice-generator-app .editor-content {
                grid-template-columns: 1fr;
                display: flex;
                flex-direction: column;
            }

            .invoice-generator-app .editor-header {
                flex-direction: row;
                justify-content: space-between;
                align-items: flex-start;
                padding: 10px 16px;
                gap: 8px;
            }

            .invoice-generator-app .editor-header h2 {
                font-size: 1em;
            }

            .invoice-generator-app .header-badge {
                font-size: 0.68em;
                padding: 2px 7px;
            }

            /* Sidebar and preview shown/hidden by JS via .mobile-hidden */
            .invoice-generator-app .editor-sidebar {
                max-height: none;
                overflow-y: visible;
                border-right: none;
                border-bottom: none;
                order: 1;
            }

            .invoice-generator-app .preview-column {
                order: 2;
                flex-direction: column;
            }

            .invoice-generator-app .editor-preview {
                max-height: none;
                overflow-y: visible;
                padding: 10px 8px;
            }

            .invoice-generator-app .editor-sidebar.mobile-hidden,
            .invoice-generator-app .preview-column.mobile-hidden {
                display: none !important;
            }

            .invoice-generator-app .invoice-preview-wrapper {
                min-height: unset !important;
                border-radius: 6px;
                overflow: hidden;
                padding: 0 !important;
                box-shadow: 0 2px 10px rgba(0,0,0,0.10);
            }

            .invoice-generator-app .invoice-preview-scaler {
                overflow: hidden;
                width: 100%;
                display: block;
            }

            .invoice-generator-app .invoice-body {
                padding: 30px 24px;
            }

            .invoice-generator-app .action-buttons {
                display: flex;
                flex-wrap: wrap;
                gap: 8px;
                justify-content: flex-start;
                padding: 10px 12px;
                margin-bottom: 12px;
                position: static;
                border-radius: 8px;
                box-shadow: 0 1px 4px rgba(0,0,0,0.07);
                border-top: none;
            }

            .invoice-generator-app .action-buttons .btn {
                flex: 1 1 calc(50% - 8px);
                min-width: 100px;
                justify-content: center;
                text-align: center;
                font-size: 0.82em;
                padding: 8px 10px;
            }
            .invoice-generator-app .item-row {
                grid-template-columns: 1fr 1fr;
                gap: 8px;
            }

            .invoice-generator-app .item-row .item-desc {
                grid-column: 1 / -1;
            }
        }

        @media (max-width: 480px) {
            .invoice-generator-app .editor-sidebar {
                padding: 20px 14px;
            }

            .invoice-generator-app .action-buttons .btn {
                flex: 1 1 100%;
            }

            .invoice-generator-app .editor-preview {
                padding: 8px 4px;
            }

            .invoice-generator-app .invoice-preview-wrapper {
                border-radius: 4px;
            }

            .invoice-generator-app .mobile-tab-toggle .tab-btn {
                font-size: 0.8em;
                padding: 6px 10px;
            }
        }

        /* Color presets */
        .invoice-generator-app .color-preset {
            width: 24px;
            height: 24px;
            border-radius: 50%;
            cursor: pointer;
            border: 2px solid transparent;
            transition: transform 0.15s, border-color 0.15s;
            flex-shrink: 0;
        }
        .invoice-generator-app .color-preset:hover,
        .invoice-generator-app .color-preset.active {
            transform: scale(1.2);
            border-color: #111827;
        }
        /* Select styling */
        .invoice-generator-app .editor-sidebar select {
            width: 100%;
            padding: 8px 10px;
            border: 1px solid #d1d5db;
            border-radius: 6px;
            font-size: 0.9em;
            background: white;
            color: #111827;
            cursor: pointer;
        }

        .invoice-generator-app .section {
            margin-bottom: 25px;
        }

        .invoice-generator-app .section h3 {
            color: #1a5f3f;
            margin-bottom: 15px;
            font-size: 1.1em;
            border-bottom: 2px solid #1a5f3f;
            padding-bottom: 8px;
        }

        .invoice-generator-app .form-group {
            margin-bottom: 15px;
        }

        .invoice-generator-app .form-group label {
            display: block;
            margin-bottom: 5px;
            color: #333;
            font-weight: 500;
            font-size: 0.9em;
        }

        .invoice-generator-app .form-group input,
        .invoice-generator-app .form-group textarea {
            width: 100%;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 5px;
            font-size: 14px;
            transition: border-color 0.3s;
        }

        .invoice-generator-app .form-group input:focus,
        .invoice-generator-app .form-group textarea:focus {
            outline: none;
            border-color: #1a5f3f;
        }

        .invoice-generator-app .logo-preview {
            width: 120px;
            height: 120px;
            border: 2px dashed #ddd;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin-top: 10px;
            overflow: hidden;
            background: white;
        }

        .invoice-generator-app .logo-preview img {
            max-width: 100%;
            max-height: 100%;
            object-fit: contain;
        }

        .invoice-generator-app .item-row {
            display: grid;
            grid-template-columns: 2fr 1fr 1fr 1fr auto;
            gap: 8px;
            margin-bottom: 10px;
            align-items: end;
        }

        .invoice-generator-app .btn {
            padding: 10px 20px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-size: 14px;
            transition: all 0.3s;
            font-weight: 500;
        }

        .invoice-generator-app .btn-primary {
            background: white;
            color: #1a5f3f;
            border: 2px solid #1a5f3f;
        }

        .invoice-generator-app .btn-primary:hover {
            background: #f0f9f4;
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(26, 95, 63, 0.15);
        }

        .invoice-generator-app .btn-success {
            background: #1a5f3f;
            color: white;
        }

        .invoice-generator-app .btn-success:hover {
            background: #2d8659;
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(26, 95, 63, 0.3);
        }

        .invoice-generator-app .btn-whatsapp {
            background: white;
            color: #25D366;
            border: 2px solid #25D366;
        }

        .invoice-generator-app .btn-whatsapp:hover {
            background: #f0fdf4;
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(37, 211, 102, 0.15);
        }

        .invoice-generator-app .btn-email {
            background: white;
            color: #f59e0b;
            border: 2px solid #f59e0b;
        }

        .invoice-generator-app .btn-email:hover {
            background: #fffbeb;
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(245, 158, 11, 0.15);
        }

        .invoice-generator-app .btn-danger {
            background: #f56565;
            color: white;
            padding: 10px 15px;
        }

        .invoice-generator-app .btn-secondary {
            background: #718096;
            color: white;
        }

        .invoice-generator-app .btn-image {
            background: transparent;
            color: #475569;
            border: 1px solid #e2e8f0 !important;
            font-size: 12px;
            font-weight: 600;
            padding: 6px 11px;
            border-radius: 7px;
            display: inline-flex;
            align-items: center;
            gap: 5px;
        }

        .invoice-generator-app .btn-image:hover {
            background: #f1f5f9;
            color: #1e293b;
            border-color: #cbd5e1 !important;
        }

        .invoice-generator-app .btn-sm {
            padding: 8px 16px;
            font-size: 14px;
        }

        /* Modal Styles */
        .invoice-generator-app .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.55);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10000;
            backdrop-filter: blur(2px);
        }

        .invoice-generator-app .modal {
            background: white;
            border-radius: 16px;
            width: 90%;
            max-width: 520px;
            box-shadow: 0 25px 80px rgba(0, 0, 0, 0.25);
            animation: modalSlideIn 0.2s ease;
        }

        @keyframes modalSlideIn {
            from { opacity: 0; transform: translateY(-16px) scale(0.98); }
            to   { opacity: 1; transform: translateY(0) scale(1); }
        }

        .invoice-generator-app .modal-header {
            padding: 24px 28px 20px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .invoice-generator-app .modal-title {
            font-size: 20px;
            font-weight: 700;
            color: #111827;
        }

        .invoice-generator-app .modal-close {
            background: none;
            border: none;
            font-size: 22px;
            color: #9ca3af;
            cursor: pointer;
            padding: 0;
            width: 32px;
            height: 32px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 6px;
            transition: all 0.2s;
            line-height: 1;
        }

        .invoice-generator-app .modal-close:hover {
            background: #f3f4f6;
            color: #374151;
        }

        .invoice-generator-app .modal-body {
            padding: 0 28px 8px;
        }

        .invoice-generator-app .modal-body .field {
            margin-bottom: 18px;
        }

        .invoice-generator-app .modal-body label {
            display: block;
            margin-bottom: 7px;
            font-weight: 600;
            color: #374151;
            font-size: 14px;
        }

        .invoice-generator-app .modal-input,
        .invoice-generator-app .modal-textarea {
            width: 100%;
            padding: 11px 14px;
            border: 1.5px solid #e5e7eb;
            border-radius: 8px;
            font-size: 14px;
            font-family: inherit;
            color: #111827;
            background: #fafafa;
            transition: all 0.2s;
            box-sizing: border-box;
        }

        .invoice-generator-app .modal-input:focus,
        .invoice-generator-app .modal-textarea:focus {
            outline: none;
            border-color: #1a5f3f;
            background: #fff;
            box-shadow: 0 0 0 3px rgba(26, 95, 63, 0.1);
        }

        .invoice-generator-app .modal-textarea {
            resize: vertical;
            min-height: 100px;
        }

        .invoice-generator-app .email-status {
            margin-top: 4px;
            padding: 10px 14px;
            border-radius: 8px;
            font-size: 14px;
            text-align: center;
        }

        .invoice-generator-app .modal-footer {
            padding: 20px 28px 24px;
            display: flex;
            gap: 12px;
            justify-content: flex-end;
        }

        .invoice-generator-app .invoice-preview-wrapper {
            background: white;
            border-radius: 10px;
            box-shadow: 0 5px 20px rgba(0,0,0,0.15);
            padding: 0;
            min-height: 900px;
            overflow: hidden;
        }

        /* Inner padding for all templates except banner ones */
        .invoice-generator-app .invoice-body {
            padding: 50px;
        }

        .invoice-generator-app .action-buttons {
            display: flex;
            gap: 5px;
            margin-bottom: 0;
            justify-content: flex-start;
            flex-wrap: wrap;
            padding: 6px 12px 8px;
            background: #ffffff;
            border-radius: 0;
            border: none;
            border-bottom: 1px solid #e2e8f0;
            box-shadow: none;
        }

        /* Mobile preview scaling container */
        .invoice-generator-app .invoice-preview-scaler {
            width: 100%;
            overflow: hidden;
        }

        .invoice-generator-app .invoice-preview {
            background: white;
            transform-origin: top left;
            /* JS will set transform: scale() dynamically on mobile */
        }

