/* APK Marketplace - Main Stylesheet */
:root {
    --primary: #6C5CE7;
    --primary-dark: #5A4BD1;
    --secondary: #00CEC9;
    --accent: #FD79A8;
    --dark: #2D3436;
    --darker: #1a1a2e;
    --light: #F8F9FA;
    --gray: #636E72;
    --light-gray: #DFE6E9;
    --danger: #E17055;
    --success: #00B894;
    --warning: #FDCB6E;
    --info: #74B9FF;
    --shadow: 0 4px 20px rgba(0,0,0,0.1);
    --shadow-hover: 0 8px 30px rgba(0,0,0,0.15);
    --radius: 12px;
    --radius-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--light);
    color: var(--dark);
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: var(--primary);
    transition: 0.3s;
}

a:hover {
    color: var(--primary-dark);
}

/* Navbar */
.navbar {
    background: linear-gradient(135deg, var(--darker), var(--dark)) !important;
    padding: 15px 0;
    box-shadow: 0 2px 20px rgba(0,0,0,0.3);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff !important;
}

.navbar-brand span {
    color: var(--secondary);
}

.nav-link {
    color: rgba(255,255,255,0.8) !important;
    font-weight: 500;
    padding: 8px 16px !important;
    border-radius: var(--radius-sm);
    transition: 0.3s;
}

.nav-link:hover,
.nav-link.active {
    color: #fff !important;
    background: rgba(255,255,255,0.1);
}

.navbar .btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
}

.btn-cart {
    position: relative;
}

.cart-count {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--accent);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--darker) 0%, #16213E 50%, #0F3460 100%);
    padding: 80px 0;
    text-align: center;
    color: white;
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 320"><path fill="rgba(255,255,255,0.03)" d="M0,96L48,112C96,128,192,160,288,186.7C384,213,480,235,576,213.3C672,192,768,128,864,128C960,128,1056,192,1152,208C1248,224,1344,192,1392,176L1440,160L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z"></path></svg>') no-repeat bottom;
    background-size: cover;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 20px;
    position: relative;
}

.hero h1 span {
    color: var(--secondary);
}

.hero p {
    font-size: 1.2rem;
    opacity: 0.9;
    margin-bottom: 30px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
}

.hero .btn {
    padding: 12px 35px;
    font-size: 1.1rem;
    border-radius: 50px;
    font-weight: 600;
    margin: 5px;
    position: relative;
}

/* Search Bar */
.search-bar {
    background: white;
    border-radius: 50px;
    padding: 5px;
    max-width: 500px;
    margin: 30px auto 0;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    position: relative;
}

.search-bar input {
    border: none;
    padding: 15px 20px;
    font-size: 1rem;
    width: 100%;
    border-radius: 50px;
    outline: none;
}

.search-bar button {
    position: absolute;
    right: 5px;
    top: 5px;
    bottom: 5px;
    padding: 0 25px;
    border: none;
    background: var(--primary);
    color: white;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
}

.search-bar button:hover {
    background: var(--primary-dark);
}

/* APK Cards */
.apk-card {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.apk-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
}

.apk-card .card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--light-gray);
}

.apk-card .card-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    object-fit: cover;
    margin: -40px auto 10px;
    display: block;
    border: 4px solid white;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    position: relative;
    z-index: 2;
    background: white;
}

.apk-card .card-body {
    padding: 15px 20px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.apk-card .card-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--dark);
}

.apk-card .card-text {
    font-size: 0.9rem;
    color: var(--gray);
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.apk-card .card-footer {
    background: none;
    border-top: 1px solid var(--light-gray);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.apk-card .price {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary);
}

.apk-card .price.free {
    color: var(--success);
}

.apk-card .badge-featured {
    position: absolute;
    top: 10px;
    right: 10px;
    background: var(--accent);
    color: white;
    padding: 5px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    z-index: 3;
}

.apk-card .download-count {
    font-size: 0.8rem;
    color: var(--gray);
}

/* Section Titles */
.section-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 10px;
    color: var(--dark);
}

.section-subtitle {
    color: var(--gray);
    margin-bottom: 30px;
}

/* Category Pills */
.category-pill {
    display: inline-block;
    padding: 8px 20px;
    background: white;
    border: 2px solid var(--light-gray);
    border-radius: 50px;
    font-weight: 600;
    margin: 5px;
    transition: 0.3s;
    color: var(--dark);
    cursor: pointer;
}

.category-pill:hover,
.category-pill.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Buttons */
.btn {
    padding: 10px 25px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    transition: all 0.3s;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(108,92,231,0.4);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-sm {
    padding: 6px 15px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 14px 40px;
    font-size: 1.1rem;
}

/* Forms */
.form-control {
    padding: 12px 16px;
    border: 2px solid var(--light-gray);
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: 0.3s;
    width: 100%;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(108,92,231,0.15);
}

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

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--dark);
}

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* Auth Pages */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--darker), #16213E);
    padding: 20px;
}

.auth-card {
    background: white;
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 10px;
    font-weight: 800;
}

.auth-card .subtitle {
    text-align: center;
    color: var(--gray);
    margin-bottom: 30px;
}

.auth-card .btn {
    width: 100%;
    padding: 14px;
}

.auth-divider {
    text-align: center;
    margin: 20px 0;
    color: var(--gray);
    position: relative;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 45%;
    height: 1px;
    background: var(--light-gray);
}

.auth-divider::before {
    left: 0;
}

.auth-divider::after {
    right: 0;
}

/* Admin Dashboard */
.admin-sidebar {
    background: var(--darker);
    color: white;
    min-height: 100vh;
    padding: 20px;
}

.admin-sidebar .nav-link {
    color: rgba(255,255,255,0.7) !important;
    padding: 12px 20px !important;
    border-radius: var(--radius-sm);
    margin-bottom: 5px;
}

.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    background: rgba(255,255,255,0.1);
    color: white !important;
}

.admin-content {
    padding: 30px;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    transition: 0.3s;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
}

.stat-card .stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.stat-card .stat-number {
    font-size: 2rem;
    font-weight: 800;
}

.stat-card .stat-label {
    color: var(--gray);
    font-weight: 500;
}

/* APK Detail Page */
.apk-detail-header {
    background: linear-gradient(135deg, var(--darker), #16213E);
    padding: 60px 0 80px;
    color: white;
}

.apk-detail-icon {
    width: 120px;
    height: 120px;
    border-radius: 25px;
    object-fit: cover;
    border: 4px solid rgba(255,255,255,0.2);
    background: white;
}

.apk-detail-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin: 20px 0;
}

.apk-detail-meta .meta-item {
    background: rgba(255,255,255,0.1);
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 0.9rem;
}

/* Cart */
.cart-item {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 15px;
    transition: 0.3s;
}

.cart-item:hover {
    box-shadow: var(--shadow-hover);
}

.cart-item img {
    width: 70px;
    height: 70px;
    border-radius: 15px;
    object-fit: cover;
}

.cart-item .item-info {
    flex: 1;
}

.cart-item .item-info h5 {
    font-weight: 700;
    margin-bottom: 5px;
}

.cart-item .item-info .item-version {
    color: var(--gray);
    font-size: 0.85rem;
}

.cart-item .item-price {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary);
}

/* Footer */
.footer {
    background: var(--darker);
    color: rgba(255,255,255,0.7);
    padding: 40px 0;
    margin-top: 60px;
}

.footer h5 {
    color: white;
    font-weight: 700;
    margin-bottom: 20px;
}

.footer a {
    color: rgba(255,255,255,0.6);
}

.footer a:hover {
    color: white;
}

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 20px;
    margin-top: 30px;
    text-align: center;
}

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mt-5 { margin-top: 40px; }
.mb-2 { margin-bottom: 10px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mb-5 { margin-bottom: 40px; }
.p-3 { padding: 16px; }
.p-4 { padding: 24px; }
.p-5 { padding: 40px; }

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

.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -12px;
}

.col {
    flex: 1;
    padding: 0 12px;
}

.col-2 { width: 16.666%; padding: 0 12px; }
.col-3 { width: 25%; padding: 0 12px; }
.col-4 { width: 33.333%; padding: 0 12px; }
.col-6 { width: 50%; padding: 0 12px; }
.col-8 { width: 66.666%; padding: 0 12px; }

@media (max-width: 992px) {
    .col-md-4 { width: 33.333%; padding: 0 12px; }
    .col-md-6 { width: 50%; padding: 0 12px; }
    .col-md-12 { width: 100%; padding: 0 12px; }
}

@media (max-width: 768px) {
    .col-sm-6 { width: 50%; padding: 0 12px; }
    .col-sm-12 { width: 100%; padding: 0 12px; }
    .hero h1 { font-size: 2rem; }
    .row { flex-direction: column; }
    [class*="col-"] { width: 100%; }
    .auth-card { padding: 30px 20px; }
}

@media (max-width: 576px) {
    .container { padding: 0 15px; }
}

/* Table styles */
.table {
    width: 100%;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table th {
    background: var(--darker);
    color: white;
    padding: 15px 20px;
    text-align: left;
    font-weight: 600;
}

.table td {
    padding: 12px 20px;
    border-bottom: 1px solid var(--light-gray);
}

.table tr:last-child td {
    border-bottom: none;
}

.table tr:hover td {
    background: rgba(108,92,231,0.05);
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
}

.badge-success { background: #d4edda; color: #155724; }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-danger { background: #f8d7da; color: #721c24; }
.badge-info { background: #d1ecf1; color: #0c5460; }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 30px;
}

.pagination a {
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    background: white;
    border: 1px solid var(--light-gray);
    color: var(--dark);
    font-weight: 500;
    transition: 0.3s;
}

.pagination a:hover,
.pagination a.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Loading spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--light-gray);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 20px auto;
}

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

/* Download progress */
.download-progress {
    background: var(--light-gray);
    border-radius: 50px;
    height: 8px;
    overflow: hidden;
}

.download-progress .progress-bar {
    height: 100%;
    background: var(--success);
    border-radius: 50px;
    transition: width 0.3s;
}

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

.empty-state .empty-icon {
    font-size: 4rem;
    color: var(--light-gray);
    margin-bottom: 20px;
}

.empty-state h3 {
    color: var(--gray);
    margin-bottom: 10px;
}

/* Checkout */
.checkout-summary {
    background: white;
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
}

.checkout-summary h4 {
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--light-gray);
}

.checkout-total {
    display: flex;
    justify-content: space-between;
    font-size: 1.5rem;
    font-weight: 800;
    padding-top: 15px;
    border-top: 2px solid var(--light-gray);
    margin-top: 15px;
}

/* Star rating */
.star-rating {
    color: var(--warning);
    font-size: 1.2rem;
}
