/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Default brand colors - can be overridden dynamically */
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --gradient-start: #667eea;
    --gradient-end: #764ba2;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    min-height: 100vh;
    padding-top: 70px; /* Space for fixed header */
    position: relative;
}

/* Subtle background pattern overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/bg-pattern.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.08;
    pointer-events: none;
    z-index: 0;
}

/* Fallback for browsers that don't support WebP */
.no-webp body::before {
    background-image: url('../images/bg-pattern.jpg');
}

/* Ensure content is above background */
.header,
.container,
.container-small {
    position: relative;
    z-index: 1;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.container-small {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
}

/* Header - Sticky */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    padding: 12px 0;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: all 0.3s ease;
}

.header-content {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 20px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.logo {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-color);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logo-link {
    text-decoration: none;
    color: inherit;
}

.logo-link:hover {
    text-decoration: none;
}

.header-center {
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-nav {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
}

.header-nav a {
    color: #666;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.3s;
}

.header-nav a:hover {
    background: #f0f0f0;
    color: var(--primary-color);
}

.btn-link-text {
    background: transparent;
    border: none;
    color: #666 !important;
    text-decoration: none !important;
}

.btn-link-text:hover {
    color: var(--primary-color) !important;
    text-decoration: none !important;
}

.btn-link {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color) !important;
    text-decoration: none !important;
}

.btn-link:hover {
    background: var(--primary-color);
    color: white !important;
    text-decoration: none !important;
}

.btn-primary-small {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white !important;
    font-weight: 500;
    text-decoration: none !important;
}

.btn-primary-small:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    text-decoration: none !important;
}

/* Icon Buttons (for logged-in header navigation) */
.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f0f0f0;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    color: #666;
    font-size: 16px;
}

.icon-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

/* Welcome Section */
.welcome-section {
    text-align: center;
    margin-bottom: 40px;
}

.welcome-title {
    font-size: 32px;
    font-weight: bold;
    color: white;
    margin-bottom: 10px;
}

.welcome-tagline {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.9);
}

@media (max-width: 768px) {
    body {
        padding-top: 60px;
    }

    .header {
        padding: 10px 0;
    }

    .header-content {
        grid-template-columns: auto 1fr auto;
        gap: 10px;
    }

    .logo {
        font-size: 16px;
    }

    .header-center {
        font-size: 13px;
    }

    .icon-btn {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .welcome-title {
        font-size: 24px;
    }

    .welcome-tagline {
        font-size: 16px;
    }
}

/* Cards */
.card {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.card-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #333;
}

.card-subtitle {
    color: #666;
    margin-bottom: 20px;
}

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

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

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-input.input-error {
    border-color: #ef4444;
    background-color: #fef2f2;
}

.input-error-message {
    display: none;
    color: #ef4444;
    font-size: 13px;
    margin-top: 6px;
    font-weight: 500;
}

.form-input:disabled {
    background-color: #f3f4f6;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Loading state for inputs */
.form-input.loading {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

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

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

.btn-block {
    width: 100%;
    display: block;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-select-package {
    margin-top: 15px;
    padding: 10px 24px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
}

.btn-select-package:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-quick-buy {
    padding: 12px 24px;
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-quick-buy:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-quick-buy i {
    animation: bolt-flash 1.5s ease-in-out infinite;
}

@keyframes bolt-flash {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* Package Grid */
.package-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.package-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid transparent;
    position: relative;
}

.package-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

.package-name {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
}

.package-value {
    font-size: 32px;
    font-weight: bold;
    color: var(--primary-color);
    margin: 12px 0;
}

.package-price {
    font-size: 24px;
    font-weight: bold;
    color: var(--secondary-color);
    margin: 12px 0;
}

.package-description {
    color: #666;
    font-size: 14px;
    margin-bottom: 16px;
}

.package-detail {
    color: #666;
    font-size: 14px;
    margin: 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.package-detail i {
    color: var(--primary-color);
    font-size: 16px;
}

.package-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    text-transform: uppercase;
}

.package-card-popular {
    border: 2px solid #f59e0b;
    box-shadow: 0 6px 30px rgba(245, 158, 11, 0.2);
}

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.stat-label {
    color: #666;
    font-size: 14px;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin: 10px 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
    transition: width 0.3s;
}

/* Toast Notifications */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 16px 24px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    display: none;
    align-items: center;
    gap: 12px;
    z-index: 1000;
    min-width: 300px;
}

.toast.show {
    display: flex;
    animation: slideIn 0.3s ease;
}

.toast-icon {
    font-size: 24px;
    font-weight: bold;
}

.toast-success { border-left: 4px solid #10b981; }
.toast-error { border-left: 4px solid #ef4444; }
.toast-info { border-left: 4px solid #3b82f6; }
.toast-warning { border-left: 4px solid #f59e0b; }

.toast-success .toast-icon { color: #10b981; }
.toast-error .toast-icon { color: #ef4444; }
.toast-info .toast-icon { color: #3b82f6; }
.toast-warning .toast-icon { color: #f59e0b; }

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Info Box */
.info-box {
    background: #f0f9ff;
    border-left: 4px solid #3b82f6;
    padding: 16px;
    border-radius: 8px;
    margin: 20px 0;
}

.info-box ul {
    margin-left: 20px;
    margin-top: 10px;
}

.info-box li {
    margin: 8px 0;
}

/* Alert Box */
.alert {
    padding: 16px;
    border-radius: 8px;
    margin: 20px 0;
}

.alert-success {
    background: #d1fae5;
    border-left: 4px solid #10b981;
    color: #065f46;
}

.alert-warning {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    color: #92400e;
}

.alert-error {
    background: #fee2e2;
    border-left: 4px solid #ef4444;
    color: #991b1b;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1;
}

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

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

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

.modal-body {
    padding: 24px;
}

/* Profile Info */
.profile-info {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.profile-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
}

.profile-label {
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

.profile-value {
    color: #333;
    font-size: 14px;
    font-weight: 600;
    text-align: right;
}

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

    .header-content {
        flex-direction: column;
        gap: 15px;
    }

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

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }
.mt-20 { margin-top: 20px; }
.hidden { display: none; }

/* Floating Support Button */
.support-btn-float {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: all 0.3s;
    z-index: 999;
    color: white;
    font-size: 24px;
    text-decoration: none;
}

.support-btn-float:hover {
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
}

.support-btn-float i {
    animation: ring 2s ease-in-out infinite;
}

@keyframes ring {
    0%, 100% { transform: rotate(0deg); }
    10%, 30% { transform: rotate(-15deg); }
    20%, 40% { transform: rotate(15deg); }
}
