:root {
    /* Exact Colors from UI Prototype */
    --primary-blue: #5B7FED;
    --primary-blue-hover: #4A6FDC;
    --dark-blue-bg: #3C4E5F;
    --darker-blue-bg: #2C3E50;
    --light-gray-card: #C5C9CE;
    --white: #FFFFFF;
    --black: #000000;
    --text-dark: #2C3E50;
    --text-light: #FFFFFF;
    --text-gray: #6B7280;
    --border-gray: #E5E7EB;
    --success-green: #10B981;
    --error-red: #EF4444;
    --warning-yellow: #F59E0B;

    /* Spacing */
    --spacing-xs: 8px;
    --spacing-sm: 12px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-base: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 20px;
    --font-size-2xl: 24px;
    --font-size-3xl: 30px;

    /* Line Heights */
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    background-color: var(--white);
    color: var(--text-dark);
    line-height: var(--line-height-normal);
    overflow-x: hidden;
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* Header */
.header {
    background-image: url('../images/header-bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    padding: var(--spacing-xl) 0;
    position: relative;
    overflow: hidden;
    min-height: 280px;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    pointer-events: none;
}

.header-content {
    position: relative;
    z-index: 1;
}

.logo-section {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.logo-circle {
    width: 120px;
    height: 120px;
    margin: 0 auto var(--spacing-md);
    background: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-xl);
    position: relative;
}

.logo-circle img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.vip-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: var(--text-dark);
    font-size: var(--font-size-xs);
    font-weight: 700;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-md);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.store-title {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: var(--spacing-xs);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.store-subtitle {
    font-size: var(--font-size-sm);
    color: rgba(255, 255, 255, 0.8);
    font-style: italic;
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-light);
    font-size: var(--font-size-sm);
    margin-top: var(--spacing-md);
}

.ios-version {
    font-weight: 600;
}

.user-actions {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
}

.username {
    font-weight: 500;
}

.logout-link {
    color: var(--text-light);
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.logout-link:hover {
    opacity: 1;
    text-decoration: underline;
}

/* IPA Resources Section */
.ipa-resources {
    background: var(--white);
    padding: var(--spacing-lg) 0;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-md);
}

.section-title {
    font-size: var(--font-size-lg);
    font-weight: 800;
    color: #1F2937;
    letter-spacing: 0.5px;
}

.see-all-link {
    color: var(--text-gray);
    text-decoration: none;
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: color 0.2s;
}

.see-all-link:hover {
    color: var(--primary-blue);
}

.horizontal-scroll {
    display: flex;
    gap: var(--spacing-md);
    overflow-x: auto;
    padding-bottom: var(--spacing-sm);
    scrollbar-width: thin;
    scrollbar-color: var(--light-gray-card) transparent;
}

.horizontal-scroll::-webkit-scrollbar {
    height: 6px;
}

.horizontal-scroll::-webkit-scrollbar-track {
    background: transparent;
}

.horizontal-scroll::-webkit-scrollbar-thumb {
    background: var(--light-gray-card);
    border-radius: var(--radius-full);
}

.ipa-card {
    min-width: 120px;
    flex-shrink: 0;
}

.ipa-icon {
    width: 120px;
    height: 120px;
    background: #E8EAED;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--spacing-xs);
    overflow: hidden;
}

.ipa-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ipa-name {
    font-size: var(--font-size-sm);
    color: var(--text-dark);
    text-align: center;
    font-weight: 500;
}

/* Certificate Section */
.certificate-section {
    background: #2C3E50;
    padding: var(--spacing-xl) var(--spacing-md);
    margin: 0;
}

.cert-container {
    max-width: 450px;
    margin: 0 auto;
    text-align: center;
}

.cert-buttons {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin-top: var(--spacing-md);
}

.certificate-title {
    color: var(--text-light);
    font-size: var(--font-size-lg);
    font-weight: 600;
    margin-bottom: var(--spacing-md);
}

.certificate-selector {
    position: relative;
    margin-bottom: var(--spacing-md);
}

.certificate-select {
    width: 100%;
    padding: var(--spacing-md);
    background: var(--white);
    border: none;
    border-radius: 20px;
    font-size: var(--font-size-base);
    font-weight: 500;
    color: var(--text-dark);
    appearance: none;
    cursor: pointer;
    background-image: url('data:image/svg+xml,\u003csvg xmlns=\"http://www.w3.org/2000/svg\" width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"%233C4E5F\"\u003e\u003cpath fill-rule=\"evenodd\" d=\"M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z\" clip-rule=\"evenodd\"/\u003e\u003c/svg\u003e');
    background-repeat: no-repeat;
    background-position: right var(--spacing-md) center;
    padding-right: 50px;
}

.certificate-select:focus {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

.certificate-actions {
    display: flex;
    gap: var(--spacing-sm);
    flex-wrap: wrap;
    margin-bottom: var(--spacing-md);
}

.cert-action-link {
    color: var(--text-light);
    text-decoration: none;
    font-size: var(--font-size-sm);
    font-weight: 500;
    opacity: 0.9;
    transition: opacity 0.2s;
}

.cert-action-link:hover {
    opacity: 1;
    text-decoration: underline;
}

.cert-action-link:not(:last-child)::after {
    content: '|';
    margin-left: var(--spacing-sm);
    opacity: 0.5;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: var(--font-size-base);
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 50px;
    min-width: 120px;
}

.btn-primary {
    background: #5B7FED;
    color: var(--text-light);
    box-shadow: 0 4px 12px rgba(91, 127, 237, 0.3);
}

.btn-primary:hover {
    background: #4A6FDC;
    box-shadow: 0 6px 16px rgba(91, 127, 237, 0.4);
    transform: translateY(-2px);
}

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

.btn-primary:disabled {
    background: #9CA3AF;
    color: #D1D5DB;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

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

.btn-get {
    background: #5B7FED;
    color: var(--text-light);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-size: var(--font-size-sm);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    min-width: 90px;
    min-height: 44px;
    border-radius: 22px;
    box-shadow: 0 3px 10px rgba(91, 127, 237, 0.3);
}

/* App Cards */
.apps-section {
    padding: var(--spacing-lg) 0;
}

.app-card {
    background: #AAB3BC;
    border-radius: 20px;
    padding: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    display: flex;
    gap: var(--spacing-md);
    align-items: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.app-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.app-icon {
    width: 80px;
    height: 80px;
    min-width: 80px;
    background: var(--white);
    border-radius: 18px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.app-info {
    flex: 1;
    min-width: 0;
}

.app-name {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--white);
    margin-bottom: 4px;
    text-transform: uppercase;
}

.app-version {
    font-size: var(--font-size-xs);
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: var(--spacing-xs);
    font-weight: 600;
}

.app-description-label {
    display: none;
}

.app-description {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8);
    line-height: var(--line-height-tight);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.app-description-label {
    font-size: var(--font-size-xs);
    color: var(--text-gray);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.app-description {
    font-size: var(--font-size-sm);
    color: var(--text-gray);
    line-height: var(--line-height-tight);
}

.app-action {
    margin-left: auto;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.modal-title {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--text-dark);
}

.modal-close {
    background: none;
    border: none;
    font-size: var(--font-size-2xl);
    color: var(--text-gray);
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.modal-close:hover {
    background: var(--border-gray);
}

.modal-body {
    margin-bottom: var(--spacing-lg);
}

.pricing-options {
    display: grid;
    gap: var(--spacing-md);
    margin: var(--spacing-lg) 0;
}

.pricing-card {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-hover));
    color: var(--text-light);
    padding: var(--spacing-lg);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.pricing-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.pricing-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.pricing-card:hover::before {
    opacity: 1;
}

.pricing-card.featured {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: var(--text-dark);
}

.pricing-amount {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
}

.pricing-features {
    font-size: var(--font-size-sm);
    line-height: var(--line-height-relaxed);
}

.pricing-badge {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    background: rgba(255, 255, 255, 0.3);
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
}

/* Forms */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: var(--spacing-xs);
}

.form-input {
    width: 100%;
    padding: var(--spacing-md);
    font-size: var(--font-size-base);
    border: 2px solid var(--border-gray);
    border-radius: 18px;
    transition: border-color 0.2s;
}

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

/* Alerts */
.alert {
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    font-size: var(--font-size-sm);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success-green);
    border: 1px solid var(--success-green);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-red);
    border: 1px solid var(--error-red);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning-yellow);
    border: 1px solid var(--warning-yellow);
}

.alert-info {
    background: rgba(91, 127, 237, 0.1);
    color: #5B7FED;
    border: 1px solid #5B7FED;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 var(--spacing-sm);
    }

    .logo-circle {
        width: 100px;
        height: 100px;
    }

    .logo-circle img {
        width: 70px;
        height: 70px;
    }

    .store-title {
        font-size: var(--font-size-2xl);
    }

    .user-info {
        flex-direction: column;
        gap: var(--spacing-xs);
        text-align: center;
    }

    .app-card {
        flex-direction: row !important;
        text-align: left;
        padding: 15px;
        align-items: center;
    }

    .app-icon {
        margin: 0;
        width: 70px;
        height: 70px;
        min-width: 70px;
    }

    .app-info {
        flex: 1;
        min-width: 0;
        padding-right: 8px;
    }

    .app-action {
        margin-left: auto;
        width: auto;
    }

    .btn-get {
        width: auto;
        min-width: 70px;
        padding: var(--spacing-xs) var(--spacing-md);
    }

    .modal-content {
        padding: var(--spacing-lg);
    }
}

@media (min-width: 769px) {
    .app-card {
        padding: var(--spacing-lg);
    }

    .app-icon {
        width: 100px;
        height: 100px;
        min-width: 100px;
    }
}

/* Loading State */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spin 1s ease-in-out infinite;
}

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

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

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

.mt-sm {
    margin-top: var(--spacing-sm);
}

.mt-md {
    margin-top: var(--spacing-md);
}

.mt-lg {
    margin-top: var(--spacing-lg);
}

.mb-sm {
    margin-bottom: var(--spacing-sm);
}

.mb-md {
    margin-bottom: var(--spacing-md);
}

.mb-lg {
    margin-bottom: var(--spacing-lg);
}

.hidden {
    display: none;
}