/**
 * Automated Quotes System Styling
 * Pricing Configuration & Scheduled Emails Dashboard
 */

/* ==========================================================================
   PRICING CONFIGURATION
   ========================================================================== */

.pricing-config-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 24px;
    margin: 20px 0;
}

.pricing-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f0f0f0;
}

.pricing-header h2 {
    margin: 0;
    color: #333;
    font-size: 24px;
}

.pricing-actions {
    display: flex;
    gap: 8px;
}

/* Tabs */
.pricing-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 2px solid #e0e0e0;
    overflow-x: auto;
}

.pricing-tab {
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.pricing-tab:hover {
    color: #333;
    background: #f5f5f5;
}

.pricing-tab.active {
    color: #FFF200;
    border-bottom-color: #FFF200;
    background: #fffef0;
}

/* Factors Grid */
.factors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.factor-card {
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    transition: all 0.2s ease;
}

.factor-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #FFF200;
}

.factor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.factor-header h4 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.factor-type-badge {
    background: #020405;
    color: #FFF200;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
}

.factor-description {
    color: #666;
    font-size: 13px;
    margin-bottom: 16px;
    min-height: 40px;
}

/* Controls */
.multiplier-control,
.range-control,
.amount-control {
    margin: 16px 0;
}

.factor-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: linear-gradient(to right, #ff6b6b 0%, #FFF200 50%, #51cf66 100%);
    outline: none;
    -webkit-appearance: none;
}

.factor-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #020405;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.factor-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #020405;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: none;
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

.range-control {
    display: flex;
    gap: 12px;
    flex-direction: column;
}

.input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-group label {
    font-size: 13px;
    color: #666;
    min-width: 40px;
}

.factor-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.input-with-suffix {
    display: flex;
    align-items: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
}

.input-with-suffix input {
    border: none;
    padding: 8px 12px;
    flex: 1;
    font-size: 14px;
}

.input-suffix {
    background: #f0f0f0;
    padding: 8px 12px;
    font-weight: bold;
    color: #666;
}

.avg-display {
    text-align: center;
    color: #666;
    font-size: 12px;
}

/* Factor Actions */
.factor-meta {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

.factor-actions {
    display: flex;
    justify-content: space-around;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    transition: transform 0.2s ease;
}

.btn-icon:hover {
    transform: scale(1.2);
}

.pricing-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 2px solid #f0f0f0;
}

/* ==========================================================================
   SCHEDULED EMAILS DASHBOARD
   ========================================================================== */

.scheduled-emails-container {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 24px;
    margin: 20px 0;
}

.scheduled-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #f0f0f0;
}

.scheduled-header h2 {
    margin: 0;
    color: #333;
    font-size: 24px;
}

.scheduled-stats {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stat-badge {
    background: #FFF200;
    color: #020405;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 14px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.empty-state h3 {
    color: #333;
    margin-bottom: 12px;
}

.empty-state p {
    margin: 8px 0;
}

/* Email Cards */
.scheduled-emails-list {
    display: grid;
    gap: 16px;
}

.scheduled-email-card {
    background: #fafafa;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
}

.scheduled-email-card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border-color: #FFF200;
}

.scheduled-email-card.overdue {
    border-color: #ff6b6b;
    background: #fff5f5;
}

.scheduled-email-card.follow-up-card {
    border-left: 4px solid #74c0fc;
}

.scheduled-email-card.follow-up-card:hover {
    border-color: #74c0fc;
}

.email-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e0e0e0;
}

.email-type-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
}

.badge-quote {
    background: #FFF200;
    color: #020405;
}

.badge-follow-up {
    background: #74c0fc;
    color: #ffffff;
}

.email-info h4 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: #333;
}

.customer-name,
.customer-email {
    margin: 4px 0;
    font-size: 14px;
    color: #666;
}

.email-amount {
    text-align: right;
}

.amount-label {
    font-size: 12px;
    color: #999;
    margin-bottom: 4px;
}

.amount-value {
    font-size: 24px;
    font-weight: bold;
    color: #51cf66;
}

/* Countdown */
.email-card-body {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 16px;
}

.countdown-section {
    text-align: center;
    padding: 16px;
    background: linear-gradient(135deg, #FFF200 0%, #ffe066 100%);
    border-radius: 8px;
}

.countdown-label {
    font-size: 13px;
    font-weight: 600;
    color: #020405;
    margin-bottom: 8px;
}

.countdown-timer {
    font-size: 32px;
    font-weight: bold;
    color: #020405;
    font-family: 'Courier New', monospace;
    margin: 8px 0;
}

.scheduled-time {
    font-size: 12px;
    color: #333;
    margin-top: 8px;
}

.email-status {
    display: flex;
    flex-direction: column;
    gap: 8px;
    justify-content: center;
}

.status-badge {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.status-pending {
    background: #fff3bf;
    color: #996800;
}

.status-processing {
    background: #d3f9d8;
    color: #2b8a3e;
}

.status-sent {
    background: #d3f9d8;
    color: #2b8a3e;
}

.status-failed {
    background: #ffe3e3;
    color: #c92a2a;
}

.status-cancelled {
    background: #e9ecef;
    color: #495057;
}

.retry-badge {
    background: #fff9db;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    text-align: center;
}

/* Actions */
.email-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.email-card-actions .btn {
    flex: 1;
    min-width: 120px;
    font-size: 13px;
}

.scheduled-footer {
    text-align: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e0e0e0;
}

/* Modal Overlay */
.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;
}

.modal-content {
    background: white;
    border-radius: 8px;
    padding: 32px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h3 {
    margin-top: 0;
}

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

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

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Preview Result */
.preview-result {
    margin-top: 24px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.preview-result h4 {
    margin-top: 0;
    color: #333;
}

.price-breakdown {
    margin-top: 16px;
}

.price-line {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
}

.price-line.indent {
    padding-left: 20px;
    color: #666;
}

.price-line.total {
    border-top: 2px solid #FFF200;
    padding-top: 12px;
    margin-top: 8px;
    font-size: 16px;
    font-weight: bold;
}

.price-range {
    text-align: center;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e0e0e0;
}

/* Responsive */
@media (max-width: 768px) {
    .factors-grid {
        grid-template-columns: 1fr;
    }

    .email-card-body {
        grid-template-columns: 1fr;
    }

    .email-card-actions .btn {
        min-width: 100%;
    }

    .pricing-tabs {
        flex-wrap: wrap;
    }
}
