/* ========================================
   OFFER BUILDER - MODULE-SPECIFIC STYLES
   ⚠️ Header styles provided by shared-header.css
   ⚠️ Layout provided by main-content-wrapper
   ======================================== */

/* ========================================
   OFFER LIBRARY SECTION
   ======================================== */

/* Offers Grid */
.offers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.empty-state i {
    color: #9ca3af;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 8px 0;
}

.empty-state p {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 24px 0;
    max-width: 400px;
}

/* Offer Card */
.offer-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.offer-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
    transform: translateY(-2px);
}

/* Card Header */
.offer-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.offer-card-header h3 {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
    flex: 1;
    line-height: 1.3;
}

.value-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    min-width: 60px;
}

.value-ratio {
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
}

.value-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.9;
    margin-top: 2px;
}

/* Card Body */
.offer-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.offer-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #6b7280;
}

.offer-meta-row i {
    color: #9ca3af;
    flex-shrink: 0;
}

.meta-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Card Stats */
.offer-card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.stat-col {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
}

.stat-col.highlight {
    background: #fef3c7;
    padding: 8px;
    border-radius: 6px;
}

.stat-col .stat-value {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
}

.stat-col.highlight .stat-value {
    color: #f59e0b;
}

.stat-col .stat-label {
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Card Actions */
.offer-card-actions {
    display: flex;
    gap: 8px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.btn-icon {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6b7280;
}

.btn-icon:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #1f2937;
}

.btn-icon:active {
    transform: scale(0.95);
}

/* ========================================
   OFFER FORM SECTION
   ======================================== */

.offer-form-section {
    max-width: 700px;
    margin: 0 auto;
}

.offer-form-section h2 {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 8px;
}

.section-description {
    font-size: 15px;
    color: #6b7280;
    margin-bottom: 32px;
    line-height: 1.6;
}

.offer-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.form-group select {
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    color: #1f2937;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.form-group select:hover {
    border-color: #9ca3af;
}

.form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-hint {
    font-size: 13px;
    color: #6b7280;
    font-style: italic;
}

.form-actions {
    margin-top: 16px;
}

.btn-generate {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.btn-generate:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.btn-generate:active {
    transform: translateY(0);
}

/* Credits Badge */
.credits-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: var(--ax-font-size-xs, 12px);
    font-weight: var(--ax-font-weight-medium, 500);
    padding: 2px 8px;
    border-radius: var(--ax-radius-full, 9999px);
    margin-left: var(--ax-space-2, 8px);
}

.credits-badge__icon {
    width: 12px;
    height: 12px;
    color: var(--ax-color-warning, #f59e0b);
}

/* ========================================
   OFFER PREVIEW SECTION
   ======================================== */

.offer-preview-section {
    animation: fadeIn 0.3s ease;
}

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

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
    gap: 16px;
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-back:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    color: #1f2937;
}

.preview-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
    flex: 1;
}

.preview-actions {
    display: flex;
    gap: 12px;
}

.btn-primary, .btn-secondary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn-primary:hover {
    background: #2563eb;
    border-color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

.btn-secondary:hover {
    background: #f9fafb;
    border-color: #9ca3af;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Offer Metadata Grid */
.offer-meta {
    margin-bottom: 32px;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.meta-item.highlight {
    background: white;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #d1d5db;
}

.meta-label {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.meta-value {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.meta-item.highlight .meta-value {
    font-size: 20px;
    color: #3b82f6;
}

/* Offer Content - Markdown Styling */
.offer-content {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 32px;
    font-size: 15px;
    line-height: 1.7;
    color: #374151;
}

/* Markdown Elements */
.offer-content h1 {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 24px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid #e5e7eb;
}

.offer-content h2 {
    font-size: 22px;
    font-weight: 700;
    color: #1f2937;
    margin: 32px 0 16px 0;
}

.offer-content h3 {
    font-size: 18px;
    font-weight: 600;
    color: #374151;
    margin: 24px 0 12px 0;
}

.offer-content h4 {
    font-size: 16px;
    font-weight: 600;
    color: #4b5563;
    margin: 20px 0 10px 0;
}

.offer-content p {
    margin: 0 0 16px 0;
    line-height: 1.7;
}

.offer-content ul, .offer-content ol {
    margin: 16px 0;
    padding-left: 24px;
}

.offer-content li {
    margin: 8px 0;
    line-height: 1.6;
}

.offer-content strong {
    font-weight: 600;
    color: #1f2937;
}

.offer-content em {
    font-style: italic;
    color: #6b7280;
}

.offer-content blockquote {
    margin: 20px 0;
    padding: 16px 20px;
    border-left: 4px solid #3b82f6;
    background: #f0f9ff;
    font-style: italic;
    color: #1e40af;
}

.offer-content code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    color: #dc2626;
}

.offer-content pre {
    background: #1f2937;
    color: #f9fafb;
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 16px 0;
}

.offer-content pre code {
    background: transparent;
    padding: 0;
    color: #f9fafb;
}

.offer-content hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 24px 0;
}

/* Special styling for value highlights */
.offer-content li:has(strong) {
    background: #fef3c7;
    padding: 8px 12px;
    border-radius: 4px;
    margin: 12px 0;
    border-left: 3px solid #f59e0b;
}

/* ========================================
   MODALS
   ======================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-container.modal-large {
    max-width: 900px;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.btn-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
}

.btn-close:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.modal-body {
    padding: 24px;
}

.modal-description {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 24px 0;
    line-height: 1.6;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid #e5e7eb;
}

/* Modal Loading/Error States */
.modal-loading,
.modal-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    min-height: 400px;
    text-align: center;
    background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
    border-radius: 12px;
    margin: 20px;
}

.modal-loading p,
.modal-error p {
    font-size: 14px;
    color: #6b7280;
    margin: 12px 0 0 0;
}

.modal-error i {
    color: #ef4444;
}

/* ========================================
   LOADING & ERROR STATES
   ======================================== */

.loading-state,
.modal-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.spinner {
    width: 64px;
    height: 64px;
    border: 5px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 24px auto;
    display: block;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-state p,
.modal-loading p {
    font-size: 15px;
    color: #6b7280;
    margin: 0;
}

.modal-loading h3 {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.error-state,
.modal-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.error-state i,
.modal-error i {
    color: #ef4444;
    margin-bottom: 16px;
}

.error-state h3 {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 8px 0;
}

.error-state p,
.modal-error p {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 24px 0;
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 20px;
    background: #1f2937;
    color: white;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    animation: slideInUp 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 250px;
    max-width: 450px;
}

.toast i {
    flex-shrink: 0;
}

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

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(10px);
    }
}

.toast.toast-success {
    background: #10b981;
}

.toast.toast-error {
    background: #ef4444;
}

.toast.toast-info {
    background: #3b82f6;
}

.toast.toast-warning {
    background: #f59e0b;
}

/* Responsive Design */
@media (max-width: 768px) {
    .preview-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .preview-actions {
        width: 100%;
    }

    .meta-grid {
        grid-template-columns: 1fr;
    }

    .toast {
        left: 16px;
        right: 16px;
        bottom: 16px;
        min-width: auto;
    }
}
