/**
 * Premium Pages Styling
 * Location: /var/www/saafee/public/css/premium.css
 * Premium pricing page + AI Image Generator
 */

/* ============================================
   Premium Pricing Page
   ============================================ */

.premium-container {
    max-width: 900px;
    margin: 20px auto;
    padding: 16px;
    flex: 1;
    width: 100%;
}

/* --- A. Hero Header --- */
.premium-header {
    text-align: center;
    margin-bottom: 32px;
}

.premium-crown-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #D4A017 0%, #F2C94C 100%);
    font-size: 1.6em;
    margin-bottom: 14px;
    box-shadow: 0 4px 16px rgba(212, 160, 23, 0.3);
}

.premium-header h1 {
    font-size: 1.8em;
    margin-bottom: 8px;
    color: #1a1a1a;
}

.premium-header p {
    font-size: 1em;
    color: #666;
    max-width: 480px;
    margin: 0 auto;
    line-height: 1.5;
}

/* --- B. Pricing Toggle + Price Display (inside CTA) --- */
.pricing-toggle {
    display: inline-flex;
    background: #f0f0f0;
    border-radius: 30px;
    padding: 4px;
    gap: 0;
    margin-bottom: 14px;
}

.subscribe-cta .pricing-toggle {
    display: flex;
    max-width: 380px;
    margin: 0 auto 14px;
}

.pricing-toggle-btn {
    flex: 1;
    padding: 10px 20px;
    border: none;
    background: transparent;
    border-radius: 26px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
    color: #666;
    transition: all 0.25s;
    min-height: 44px;
    white-space: nowrap;
}

.pricing-toggle-btn.active {
    background: linear-gradient(135deg, #D4A017 0%, #F2C94C 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(212, 160, 23, 0.3);
}

.pricing-toggle-btn:not(.active):hover {
    color: #333;
}

.pricing-display {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.pricing-display.active {
    display: flex;
    margin-bottom: 20px;
}

.price-original {
    font-size: 1.2em;
    color: #999;
    text-decoration: line-through;
}

.price-discount-badge {
    display: inline-block;
    background: linear-gradient(135deg, #D4A017 0%, #F2C94C 100%);
    color: #fff;
    font-size: 0.8em;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
}

.price-main {
    font-size: 2.4em;
    font-weight: 800;
    color: #D4A017;
    line-height: 1.1;
}

.price-period {
    color: #666;
    font-size: 0.9em;
}

.price-equivalent {
    color: #D4A017;
    font-size: 0.88em;
    font-weight: 600;
}

.limited-badge {
    display: inline-block;
    background: #E44335;
    color: #fff;
    font-size: 0.78em;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 6px 16px;
    border-radius: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 10px rgba(228, 67, 53, 0.3);
    animation: badge-pulse 2s ease-in-out infinite;
}

@keyframes badge-pulse {
    0%, 100% { box-shadow: 0 2px 10px rgba(228, 67, 53, 0.3); }
    50% { box-shadow: 0 2px 18px rgba(228, 67, 53, 0.55); }
}

/* --- C. Feature Cards (2x2 grid) --- */
.premium-features {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 36px;
}

.premium-feat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #E0E0E0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.feat-icon {
    font-size: 2em;
    margin-bottom: 8px;
}

.premium-feat-card h3 {
    font-size: 1.15em;
    margin-bottom: 6px;
    color: #333;
}

.feat-desc {
    color: #666;
    font-size: 0.9em;
    line-height: 1.5;
    margin-bottom: 14px;
}

.feat-tiers {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.feat-tier-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.88em;
}

.feat-tier-free {
    background: #f5f5f5;
}

.feat-tier-premium {
    background: #FFF8E7;
    border-left: 3px solid #D4A017;
}

[dir="rtl"] .feat-tier-premium {
    border-left: none;
    border-right: 3px solid #D4A017;
}

.feat-tier-label {
    font-weight: 700;
    min-width: 64px;
    flex-shrink: 0;
}

.feat-tier-free .feat-tier-label {
    color: #7A7A7A;
}

.feat-tier-premium .feat-tier-label {
    color: #D4A017;
}

.feat-tier-value {
    color: #333;
}

.feat-tier-check {
    color: #D4A017;
    font-weight: 700;
}

.feat-tier-lock {
    color: #999;
    font-style: italic;
}

.feature-icon {
    font-size: 2em;
    margin-bottom: 12px;
}

/* --- D. Comparison Table --- */
.comparison-section {
    margin-bottom: 36px;
}

.comparison-section h2 {
    text-align: center;
    font-size: 1.4em;
    margin-bottom: 20px;
    color: #1a1a1a;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid #E0E0E0;
}

.comparison-table thead th {
    padding: 14px 16px;
    font-size: 0.85em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #fafafa;
    border-bottom: 2px solid #E0E0E0;
    text-align: left;
}

[dir="rtl"] .comparison-table thead th {
    text-align: right;
}

.comparison-table thead th:nth-child(2),
.comparison-table thead th:nth-child(3) {
    text-align: center;
    width: 100px;
}

.comparison-table tbody td {
    padding: 12px 16px;
    font-size: 0.92em;
    border-bottom: 1px solid #f0f0f0;
    color: #333;
}

.comparison-table tbody tr:nth-child(even) {
    background: #fafafa;
}

.comparison-table tbody td:nth-child(2),
.comparison-table tbody td:nth-child(3) {
    text-align: center;
}

.compare-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #D4A017;
    color: white;
    font-size: 0.7em;
    font-weight: 700;
}

.compare-cross {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #E0E0E0;
    color: #999;
    font-size: 0.7em;
    font-weight: 700;
}

.compare-text {
    font-size: 0.82em;
    color: #666;
}

.compare-text-premium {
    font-size: 0.82em;
    color: #D4A017;
    font-weight: 600;
}

/* --- E. Benefits Strip --- */
.benefits-strip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 36px;
    padding: 16px;
}

.benefit-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: #555;
}

.benefit-icon {
    font-size: 1.1em;
}

/* --- F. Subscribe CTA --- */
.subscribe-cta {
    background: white;
    border: 2px solid #D4A017;
    border-radius: 12px;
    padding: 28px 20px;
    text-align: center;
    margin-bottom: 30px;
    box-shadow: 0 4px 16px rgba(212, 160, 23, 0.12);
}

.btn-subscribe {
    display: block;
    width: 100%;
    background: linear-gradient(135deg, #D4A017 0%, #F2C94C 100%);
    color: white;
    padding: 14px 30px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 700;
    transition: box-shadow 0.3s, transform 0.2s;
    min-height: 48px;
}

.btn-subscribe:hover {
    box-shadow: 0 6px 20px rgba(212, 160, 23, 0.4);
    transform: translateY(-1px);
}

.cta-terms {
    margin-top: 14px;
    font-size: 0.82em;
    color: #999;
}

.cta-terms a {
    color: #D4A017;
    text-decoration: underline;
}

.cta-terms a:hover {
    color: #b8860b;
}

/* --- Upgrade Modal --- */
.upgrade-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
}

.upgrade-modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: #fefefe;
    padding: 20px;
    border-radius: 10px;
    width: 95%;
    max-width: 600px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

.modal-header h2 {
    margin: 0;
    font-size: 1.2em;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2em;
    cursor: pointer;
    color: #999;
    min-height: 44px;
    min-width: 44px;
}

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

.paypal-button-container {
    margin-top: 30px;
}

/* --- Already Premium Status --- */
.already-premium {
    background: linear-gradient(135deg, #D4A017 0%, #F2C94C 100%);
    color: white;
    padding: 24px 16px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 24px;
}

.already-premium h2 {
    font-size: 1.4em;
    margin-bottom: 10px;
}

.already-premium .premium-date {
    font-size: 1em;
    opacity: 0.9;
    margin-bottom: 10px;
}

.cancel-subscription-link {
    display: inline-flex;
    align-items: center;
    margin-top: 12px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85em;
    text-decoration: none;
    transition: color 0.2s;
    min-height: 44px;
}

.cancel-subscription-link:hover {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: underline;
}

/* Premium Feature Links Grid */
.premium-features-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 20px;
}

.premium-feature-link {
    display: block;
    background: white;
    padding: 20px;
    border-radius: 12px;
    text-decoration: none;
    color: #333;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    text-align: center;
}

.premium-feature-link:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.premium-feature-link .feature-icon {
    font-size: 2em;
    margin-bottom: 10px;
}

.premium-feature-link h3 {
    font-size: 1.1em;
    margin-bottom: 8px;
}

.premium-feature-link p {
    color: #666;
    font-size: 0.95em;
    line-height: 1.5;
}

/* RTL */
[dir="rtl"] .feat-tier-row {
    flex-direction: row;
}

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

@media (min-width: 768px) {
    /* Premium page */
    .premium-container {
        margin: 40px auto;
        padding: 20px;
    }

    .premium-crown-badge {
        width: 68px;
        height: 68px;
        font-size: 2em;
        margin-bottom: 18px;
    }

    .premium-header {
        margin-bottom: 40px;
    }

    .premium-header h1 {
        font-size: 2.4em;
    }

    .premium-header p {
        font-size: 1.1em;
    }

    .pricing-toggle-btn {
        padding: 10px 28px;
        font-size: 0.95em;
    }

    .price-main {
        font-size: 3em;
    }

    .premium-features {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        margin-bottom: 48px;
    }

    .premium-feat-card {
        padding: 24px;
    }

    .premium-feat-card h3 {
        font-size: 1.25em;
    }

    .feat-icon {
        font-size: 2.5em;
        margin-bottom: 10px;
    }

    .comparison-section h2 {
        font-size: 1.6em;
        margin-bottom: 24px;
    }

    .comparison-table thead th {
        padding: 16px 20px;
    }

    .comparison-table tbody td {
        padding: 14px 20px;
    }

    .comparison-table thead th:nth-child(2),
    .comparison-table thead th:nth-child(3) {
        width: 130px;
    }

    .benefits-strip {
        flex-direction: row;
        justify-content: center;
        gap: 36px;
        padding: 20px;
    }

    .benefit-item {
        font-size: 0.95em;
    }

    .subscribe-cta {
        padding: 32px;
        max-width: 500px;
        margin: 0 auto 40px;
    }

    .modal-content {
        width: 90%;
        padding: 30px;
    }

    .modal-header h2 {
        font-size: 1.5em;
    }

    .already-premium {
        padding: 40px;
        margin-bottom: 40px;
    }

    .already-premium h2 {
        font-size: 1.8em;
    }

    .already-premium .premium-date {
        font-size: 1.1em;
    }

    .premium-features-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 24px;
        margin-top: 30px;
    }

    .premium-feature-link {
        padding: 30px;
    }

    .premium-feature-link .feature-icon {
        font-size: 2.5em;
        margin-bottom: 12px;
    }

    .premium-feature-link h3 {
        font-size: 1.2em;
    }
}

/* ============================================
   AI Image Generator
   ============================================ */

.ig-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px;
    flex: 1;
}

.ig-header {
    text-align: center;
    color: #333;
    margin-bottom: 24px;
    padding-top: 16px;
}

.ig-header h1 {
    font-size: 1.8em;
    margin-bottom: 8px;
}

.ig-header p {
    font-size: 1em;
    opacity: 0.9;
}

.ig-main-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.ig-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.ig-card h2 {
    color: #333;
    margin-bottom: 16px;
    font-size: 1.2em;
}

/* Upload Area */
.upload-area {
    border: 3px dashed #D4A017;
    border-radius: 8px;
    padding: 20px 16px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #FFF8E7;
}

.upload-area:hover {
    border-color: #F2C94C;
    background: #FFF3D6;
}

.upload-area.dragover {
    border-color: #D4A017;
    background: #FFEDBE;
    transform: scale(1.02);
}

.upload-icon {
    font-size: 2em;
    margin-bottom: 8px;
}

.upload-text {
    color: #666;
    font-size: 1em;
    margin-bottom: 5px;
}

.upload-hint {
    color: #999;
    font-size: 0.85em;
}

.ig-container input[type="file"] {
    display: none;
}

.image-preview {
    margin-top: 20px;
    text-align: center;
    display: none;
}

.image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.preview-info {
    margin-top: 15px;
    color: #666;
    font-size: 0.9em;
}

/* Form */
.ig-container .form-group {
    margin-bottom: 20px;
}

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

.ig-container select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    background: white;
    cursor: pointer;
    min-height: 44px;
}

.ig-container select:focus {
    outline: none;
    border-color: #D4A017;
    box-shadow: 0 0 0 3px rgba(212, 160, 23, 0.15);
}

/* Buttons */
.ig-button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.ig-btn {
    flex: 1;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px;
}

.ig-btn-primary {
    background: linear-gradient(135deg, #D4A017 0%, #F2C94C 100%);
    color: white;
    font-weight: 700;
}

.ig-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(212, 160, 23, 0.4);
}

.ig-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ig-btn-secondary {
    background: #f0f0f0;
    color: #333;
}

.ig-btn-secondary:hover {
    background: #e0e0e0;
}

/* Results */
.ig-results {
    margin-top: 20px;
    display: none;
}

.ig-results.show {
    display: block;
}

.description-section {
    background: #f8f9ff;
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.description-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.description-text {
    color: #666;
    line-height: 1.5;
}

/* Loading */
.ig-loading {
    display: none;
    text-align: center;
    padding: 20px;
}

.ig-spinner {
    border: 4px solid #f0f0f0;
    border-top: 4px solid #D4A017;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: ig-spin 0.8s linear infinite;
    margin: 0 auto 10px;
}

@keyframes ig-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Messages */
.ig-error-message {
    background: #fee;
    color: #c33;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
}

.ig-success-message {
    background: #efe;
    color: #3c3;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
}

/* Recent Uploads */
.recent-uploads {
    margin-top: 30px;
    max-height: 400px;
    overflow-y: auto;
}

.upload-item {
    padding: 10px;
    background: #f8f9ff;
    border-radius: 8px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9em;
}

.upload-date {
    color: #999;
}

.delete-btn {
    background: #fee;
    color: #c33;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85em;
    min-height: 44px;
}

.delete-btn:hover {
    background: #fcc;
}

/* ============================================
   AI Image Generator Responsive
   ============================================ */

@media (min-width: 768px) {
    .ig-header {
        margin-bottom: 40px;
        padding-top: 20px;
    }

    .ig-header h1 {
        font-size: 2.5em;
        margin-bottom: 10px;
    }

    .ig-header p {
        font-size: 1.1em;
    }

    .ig-main-grid {
        grid-template-columns: 1fr 1fr;
        gap: 30px;
        margin-bottom: 40px;
    }

    .ig-card {
        padding: 30px;
    }

    .ig-card h2 {
        font-size: 1.3em;
        margin-bottom: 20px;
    }

    .upload-area {
        padding: 40px 20px;
    }

    .upload-icon {
        font-size: 3em;
        margin-bottom: 10px;
    }

    .ig-button-group {
        flex-direction: row;
        margin-top: 25px;
    }
}

/* ============================================
   AI Quota Bar
   ============================================ */

.ai-quota-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #FFF8E7;
    border: 1px solid #F2C94C;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 20px;
    font-size: 0.9em;
}

.ai-quota-label {
    font-weight: 600;
    color: #333;
    white-space: nowrap;
}

.ai-quota-track {
    flex: 1;
    height: 6px;
    background: #E0E0E0;
    border-radius: 3px;
    overflow: hidden;
}

.ai-quota-fill {
    height: 100%;
    background: linear-gradient(135deg, #D4A017 0%, #F2C94C 100%);
    border-radius: 3px;
    transition: width 0.3s;
}

.ai-quota-fill.warning {
    background: #F2994A;
}

.ai-quota-fill.danger {
    background: #EB5757;
}

.ai-quota-count {
    font-weight: 600;
    color: #555;
    white-space: nowrap;
}

/* --- Premium Usage Section (premium dashboard) --- */
.premium-usage-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
    border: 1px solid #E0E0E0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.premium-usage-section h3 {
    font-size: 1.05em;
    color: #333;
    margin-bottom: 16px;
}

.premium-usage-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
}

@media (min-width: 768px) {
    .premium-usage-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.premium-usage-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.premium-usage-icon {
    font-size: 1.4em;
    flex-shrink: 0;
}

.premium-usage-detail {
    flex: 1;
    min-width: 0;
}

.premium-usage-label {
    font-size: 0.88em;
    color: #555;
    margin-bottom: 4px;
}

.premium-usage-bar {
    height: 6px;
    background: #E0E0E0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 3px;
}

.premium-usage-bar-fill {
    height: 100%;
    background: linear-gradient(135deg, #D4A017 0%, #F2C94C 100%);
    border-radius: 3px;
    transition: width 0.3s;
}

.premium-usage-bar-fill.warning { background: #F2994A; }
.premium-usage-bar-fill.danger { background: #EB5757; }

.premium-usage-count {
    font-size: 0.82em;
    color: #777;
}

.premium-usage-reset {
    text-align: center;
    font-size: 0.82em;
    color: #999;
    margin-top: 12px;
}

.ai-quota-limit-msg {
    text-align: center;
    background: #FEE;
    color: #C33;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9em;
}
