/* =====================================================
   AppStore - Main Stylesheet
   ===================================================== */

/* CSS Variables */
:root {
    --primary-color: #667eea;
    --primary-dark: #5a6fd6;
    --secondary-color: #764ba2;
    --success-color: #48bb78;
    --warning-color: #ed8936;
    --error-color: #f56565;
    --text-color: #2d3748;
    --text-light: #718096;
    --bg-color: #f7fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --gradient: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    --radius: 12px;
    --radius-sm: 8px;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
    color: var(--text-color);
    background: var(--bg-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s;
}

img {
    max-width: 100%;
    height: auto;
}

/* Container */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* =====================================================
   Navbar
   ===================================================== */
.navbar {
    background: var(--card-bg);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo i {
    font-size: 1.3rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 30px;
    list-style: none;
}

.nav-links a {
    color: var(--text-color);
    font-weight: 500;
    padding: 8px 0;
    position: relative;
}

.nav-links a:not(.btn-create):hover,
.nav-links a:not(.btn-create).active {
    color: var(--primary-color);
}

.nav-links a:not(.btn-create)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient);
    transition: width 0.3s;
}

.nav-links a:not(.btn-create):hover::after,
.nav-links a:not(.btn-create).active::after {
    width: 100%;
}

.btn-create {
    background: var(--gradient);
    color: white !important;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    transition: transform 0.3s, box-shadow 0.3s;
}

.btn-create:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* =====================================================
   Buttons
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background: var(--gradient);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.1rem;
}

.btn-download {
    background: var(--success-color);
    color: white;
    width: 100%;
    margin-top: auto;
}

.btn-download:hover {
    background: #38a169;
    transform: translateY(-2px);
}

/* =====================================================
   Hero Section
   ===================================================== */
.hero {
    background: var(--gradient);
    color: white;
    padding: 80px 0;
    text-align: center;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    font-weight: 700;
}

.hero p {
    font-size: 1.25rem;
    max-width: 600px;
    margin: 0 auto 30px;
    opacity: 0.9;
}

.hero .btn {
    box-shadow: var(--shadow-lg);
}

.hero-stats {
    display: flex;
    justify-content: center;
    gap: 60px;
    margin-top: 50px;
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
}

.stat-label {
    opacity: 0.8;
    font-size: 1rem;
}

/* =====================================================
   Features Section
   ===================================================== */
.features {
    padding: 80px 0;
}

.features h2,
.featured-apps h2,
.how-it-works h2 {
    text-align: center;
    font-size: 2.25rem;
    margin-bottom: 50px;
    color: var(--text-color);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.feature-card {
    background: var(--card-bg);
    padding: 30px;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 20px;
    background: var(--gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feature-icon i {
    font-size: 1.75rem;
    color: white;
}

.feature-card h3 {
    font-size: 1.25rem;
    margin-bottom: 10px;
}

.feature-card p {
    color: var(--text-light);
}

/* =====================================================
   Apps Grid
   ===================================================== */
.featured-apps,
.store-page {
    padding: 80px 0;
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.app-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s, box-shadow 0.3s;
}

.app-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.app-icon {
    width: 80px;
    height: 80px;
    margin-bottom: 15px;
    border-radius: 18px;
    overflow: hidden;
    flex-shrink: 0;
}

.app-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.default-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
}

.app-info {
    flex: 1;
    margin-bottom: 15px;
}

.app-info h3 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: var(--text-color);
}

.app-package {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-bottom: 8px;
    word-break: break-all;
}

.app-downloads,
.app-date {
    font-size: 0.9rem;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 6px;
}

.app-downloads i,
.app-date i {
    color: var(--primary-color);
}

.view-all {
    text-align: center;
    margin-top: 40px;
}

/* =====================================================
   How It Works
   ===================================================== */
.how-it-works {
    padding: 80px 0;
    background: var(--card-bg);
}

.steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 30px;
}

.step {
    text-align: center;
    position: relative;
}

.step-number {
    width: 60px;
    height: 60px;
    background: var(--gradient);
    color: white;
    font-size: 1.5rem;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.step h3 {
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.step p {
    color: var(--text-light);
}

/* =====================================================
   Store Page
   ===================================================== */
.store-header {
    text-align: center;
    margin-bottom: 40px;
}

.store-header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.store-header p {
    color: var(--text-light);
    font-size: 1.1rem;
}

.store-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 20px;
}

.search-form {
    flex: 1;
    max-width: 500px;
}

.search-input {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    padding: 5px;
    box-shadow: var(--shadow);
}

.search-input i {
    padding: 0 15px;
    color: var(--text-light);
}

.search-input input {
    flex: 1;
    border: none;
    padding: 12px 0;
    font-size: 1rem;
    outline: none;
}

.search-input .btn {
    padding: 10px 20px;
}

.store-stats {
    color: var(--text-light);
    font-size: 0.95rem;
}

.store-stats i {
    color: var(--primary-color);
    margin-right: 5px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 50px;
}

.page-link {
    padding: 10px 15px;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    color: var(--text-color);
    font-weight: 500;
    box-shadow: var(--shadow);
    transition: all 0.3s;
}

.page-link:hover,
.page-link.active {
    background: var(--primary-color);
    color: white;
}

.page-numbers {
    display: flex;
    gap: 5px;
}

/* No Apps */
.no-apps {
    text-align: center;
    padding: 80px 20px;
}

.no-apps i {
    font-size: 4rem;
    color: var(--border-color);
    margin-bottom: 20px;
}

.no-apps h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

.no-apps p {
    color: var(--text-light);
    margin-bottom: 20px;
}

/* =====================================================
   Create Page
   ===================================================== */
.create-page {
    padding: 60px 0;
}

.create-header {
    text-align: center;
    margin-bottom: 40px;
}

.create-header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.create-header p {
    color: var(--text-light);
    font-size: 1.1rem;
}

.create-form {
    max-width: 700px;
    margin: 0 auto;
}

.form-section {
    background: var(--card-bg);
    padding: 30px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 25px;
}

.form-section h2 {
    font-size: 1.3rem;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-section h2 i {
    color: var(--primary-color);
}

.form-group {
    margin-bottom: 20px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-color);
}

.form-group input[type="text"],
.form-group input[type="url"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.help-text {
    display: block;
    margin-top: 6px;
    font-size: 0.85rem;
    color: var(--text-light);
}

.input-prefix {
    display: flex;
    align-items: stretch;
}

.input-prefix .prefix {
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    padding: 12px 15px;
    color: var(--text-light);
    font-weight: 500;
}

.input-prefix input {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important;
}

/* File Upload */
.file-upload {
    position: relative;
}

.file-upload input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.file-upload-label {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 30px;
    text-align: center;
    transition: all 0.3s;
}

.file-upload:hover .file-upload-label {
    border-color: var(--primary-color);
    background: rgba(102, 126, 234, 0.05);
}

.file-upload-label i {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    display: block;
}

.file-upload-label span {
    display: block;
    color: var(--text-color);
    font-weight: 500;
    margin-bottom: 5px;
}

.file-upload-label small {
    color: var(--text-light);
}

.file-preview {
    margin-top: 15px;
    display: none;
}

.file-preview.active {
    display: block;
}

.file-preview img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

/* Color Picker */
.color-picker {
    display: flex;
    gap: 10px;
    align-items: center;
}

.color-picker input[type="color"] {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    padding: 0;
}

.color-picker input[type="text"] {
    width: 100px;
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-family: monospace;
}

/* Form Actions */
.form-actions {
    text-align: center;
    margin-top: 30px;
}

/* =====================================================
   Modals
   ===================================================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    max-width: 500px;
    width: 100%;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    background: var(--gradient);
    color: white;
    padding: 25px 30px;
}

.modal-header.success {
    background: var(--success-color);
}

.modal-header.error {
    background: var(--error-color);
}

.modal-header h2 {
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-body {
    padding: 30px;
}

/* Progress Bar */
.progress-container {
    margin-bottom: 20px;
}

.progress-bar {
    height: 12px;
    background: var(--bg-color);
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: var(--gradient);
    border-radius: 6px;
    width: 0%;
    transition: width 0.5s ease;
}

.progress-text {
    display: block;
    text-align: right;
    font-weight: 600;
    color: var(--primary-color);
}

.progress-status {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 20px;
}

.build-log {
    background: var(--bg-color);
    border-radius: var(--radius-sm);
    padding: 15px;
    max-height: 200px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 0.85rem;
}

.build-log .log-entry {
    padding: 5px 0;
    border-bottom: 1px solid var(--border-color);
}

.build-log .log-entry:last-child {
    border-bottom: none;
}

.build-log .log-info {
    color: var(--text-color);
}

.build-log .log-success {
    color: var(--success-color);
}

.build-log .log-warning {
    color: var(--warning-color);
}

.build-log .log-error {
    color: var(--error-color);
}

.success-actions,
.error-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

/* =====================================================
   Error Page
   ===================================================== */
.error-page {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-content {
    text-align: center;
    padding: 60px 20px;
}

.error-content i {
    font-size: 4rem;
    color: var(--warning-color);
    margin-bottom: 20px;
}

.error-content h1 {
    font-size: 2rem;
    margin-bottom: 15px;
}

.error-content p {
    color: var(--text-light);
    margin-bottom: 30px;
}

/* =====================================================
   Footer
   ===================================================== */
.footer {
    background: var(--text-color);
    color: white;
    padding: 60px 0 30px;
    margin-top: auto;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-brand h3 {
    font-size: 1.4rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.footer-brand p {
    color: rgba(255, 255, 255, 0.7);
}

.footer-links h4 {
    font-size: 1.1rem;
    margin-bottom: 15px;
}

.footer-links ul {
    list-style: none;
}

.footer-links li {
    margin-bottom: 10px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.3s;
}

.footer-links a:hover {
    color: white;
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
}

/* =====================================================
   Responsive
   ===================================================== */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 20px;
    }
    
    .nav-links {
        gap: 15px;
    }
    
    .store-toolbar {
        flex-direction: column;
    }
    
    .search-form {
        max-width: 100%;
        width: 100%;
    }
    
    .apps-grid {
        grid-template-columns: 1fr;
    }
    
    .steps {
        grid-template-columns: 1fr;
    }
    
    .form-section {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .navbar .container {
        flex-direction: column;
        height: auto;
        padding: 15px 20px;
        gap: 15px;
    }
    
    .nav-links {
        width: 100%;
        justify-content: space-between;
    }
    
    .hero {
        padding: 50px 0;
    }
    
    .hero h1 {
        font-size: 1.75rem;
    }
    
    .btn-large {
        padding: 14px 24px;
        font-size: 1rem;
    }
}
