/* Google Font: Outfit */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-primary: #080b11;
    --bg-secondary: #0d121f;
    --bg-card: rgba(18, 24, 38, 0.65);
    --border-glass: rgba(255, 255, 255, 0.06);
    --border-glass-hover: rgba(255, 255, 255, 0.12);
    
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --accent-cyan: #00f2fe;
    --accent-purple: #9d4edd;
    --accent-grad-start: #00f2fe;
    --accent-grad-end: #4facfe;
    --gradient-glow: linear-gradient(135deg, var(--accent-grad-start), var(--accent-grad-end));
    
    --success: #10b981;
    --danger: #f43f5e;
    --warning: #f59e0b;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-outfit: 'Outfit', sans-serif;
}

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-primary);
    background-image: 
        radial-gradient(at 10% 20%, rgba(0, 242, 254, 0.05) 0px, transparent 50%),
        radial-gradient(at 90% 80%, rgba(157, 78, 221, 0.05) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: var(--font-outfit);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

button, input, textarea, select {
    font-family: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--border-glass-hover);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-grad-end);
}

/* Navbar */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(8, 11, 17, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-glass);
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.brand-logo {
    width: 40px;
    height: 40px;
    background: var(--gradient-glow);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0, 242, 254, 0.3);
}

.brand-logo svg {
    width: 22px;
    height: 22px;
    fill: #fff;
}

.brand-text {
    background: linear-gradient(to right, #ffffff, #9ca3af);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.btn-nav {
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.95rem;
    border: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.03);
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-nav:hover {
    border-color: var(--accent-cyan);
    background: rgba(0, 242, 254, 0.05);
    box-shadow: 0 0 15px rgba(0, 242, 254, 0.1);
}

#hamburgerBtn {
    background: var(--gradient-glow);
    border: none;
    color: #080b11;
    box-shadow: 0 4px 15px rgba(0, 242, 254, 0.3);
}

#hamburgerBtn:hover {
    color: #080b11;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 242, 254, 0.5);
}

.btn-primary {
    background: var(--gradient-glow);
    border: none;
    color: #080b11;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 242, 254, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 242, 254, 0.4);
    background: var(--gradient-glow);
}

.btn-danger {
    background: rgba(244, 63, 94, 0.1);
    color: var(--danger);
    border: 1px solid rgba(244, 63, 94, 0.2);
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
    box-shadow: 0 4px 15px rgba(244, 63, 94, 0.3);
}

/* Main Container */
.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 2.5rem 1.5rem;
    flex-grow: 1;
}

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 3.5rem;
    animation: fadeIn 0.8s ease;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #ffffff 30%, #a18cd1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    color: var(--text-secondary);
    font-size: 1.15rem;
    max-width: 600px;
    margin: 0 auto 2rem auto;
}

/* Search and Filters */
.search-filter-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.search-bar-wrapper {
    position: relative;
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
}

.search-input {
    width: 100%;
    padding: 1rem 1.5rem 1rem 3.5rem;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    font-size: 1.05rem;
    transition: var(--transition);
    backdrop-filter: blur(10px);
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-cyan);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 0 20px rgba(0, 242, 254, 0.15);
}

.search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
    width: 20px;
    height: 20px;
}

.filters-wrapper {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.filter-pill {
    padding: 0.6rem 1.2rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
}

.filter-pill:hover {
    color: var(--text-primary);
    border-color: var(--border-glass-hover);
    background: rgba(255, 255, 255, 0.06);
}

.filter-pill.active {
    background: var(--gradient-glow);
    color: #080b11;
    border-color: transparent;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 242, 254, 0.25);
}

/* App Grid */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 2rem;
}

.app-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.app-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-cyan);
    box-shadow: 0 10px 30px rgba(0, 242, 254, 0.1);
}

.app-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-glow);
    opacity: 0;
    transition: var(--transition);
}

.app-card:hover::before {
    opacity: 1;
}

.app-header {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.app-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    object-fit: cover;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-glass);
}

.app-title-meta {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0; /* allows text truncation */
}

.app-name {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-version {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.app-category {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    background: rgba(0, 242, 254, 0.1);
    color: var(--accent-cyan);
    border-radius: 8px;
    align-self: flex-start;
    font-weight: 600;
    text-transform: uppercase;
}

.app-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
    line-height: 1.45;
}

.app-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
}

.download-count {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.download-count svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Modal Popup styling */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(5, 7, 11, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    padding: 1.5rem;
}

.modal.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass-hover);
    border-radius: 28px;
    max-width: 600px;
    width: 100%;
    padding: 2.25rem;
    position: relative;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    transition: var(--transition);
}

.modal-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.modal-header {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.modal-body h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.modal-body p {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    white-space: pre-line;
}

/* Empty/No Results state */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--bg-card);
    border: 1px dashed var(--border-glass);
    border-radius: 24px;
    margin-top: 2rem;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    fill: var(--text-muted);
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-secondary);
}

/* Login Page Wrapper */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
    padding: 2rem;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 28px;
    padding: 2.5rem;
    max-width: 420px;
    width: 100%;
    backdrop-filter: blur(12px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
}

.login-title {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 2rem;
    background: linear-gradient(135deg, #ffffff, #a18cd1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent-cyan);
    background: rgba(255, 255, 255, 0.04);
}

.form-select {
    width: 100%;
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%239ca3af' width='18' height='18'%3E%3Cpath d='M7 10l5 5 5-5H7z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
}

.form-select:focus {
    outline: none;
    border-color: var(--accent-cyan);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.alert-message {
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-error {
    background: rgba(244, 63, 94, 0.1);
    color: var(--danger);
    border: 1px solid rgba(244, 63, 94, 0.2);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Admin Dashboard layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
}

@media(min-width: 992px) {
    .dashboard-grid {
        grid-template-columns: 380px 1fr;
    }
}

.admin-card {
    background: var(--bg-card);
    border: 1px solid var(--border-glass);
    border-radius: 24px;
    padding: 1.75rem;
    backdrop-filter: blur(10px);
}

.admin-card h2 {
    font-size: 1.35rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-box {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    border-radius: 16px;
    padding: 1.25rem 1rem;
    text-align: center;
}

.stat-val {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent-cyan);
    margin-bottom: 0.25rem;
}

.stat-lbl {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
}

/* File Upload drag area */
.drag-area {
    border: 2px dashed var(--border-glass-hover);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.01);
}

.drag-area:hover, .drag-area.active {
    border-color: var(--accent-cyan);
    background: rgba(0, 242, 254, 0.02);
}

.drag-area svg {
    width: 32px;
    height: 32px;
    fill: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.drag-area span {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: block;
}

.upload-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Admin App List Table */
.table-wrapper {
    overflow-x: auto;
    border-radius: 16px;
    border: 1px solid var(--border-glass);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
}

.admin-table th {
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-glass);
}

.admin-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-glass);
    vertical-align: middle;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

.table-app-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.table-app-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--border-glass);
}

.action-btns {
    display: flex;
    gap: 0.5rem;
}

.btn-icon {
    padding: 0.4rem;
    border-radius: 8px;
    border: 1px solid var(--border-glass);
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    border-color: var(--accent-cyan);
    background: rgba(0, 242, 254, 0.05);
}

.btn-icon.delete:hover {
    border-color: var(--danger);
    background: rgba(244, 63, 94, 0.05);
    color: var(--danger);
}

.btn-icon svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* Footer styling */
footer {
    border-top: 1px solid var(--border-glass);
    padding: 1.5rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: auto;
}

/* Keyframes */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Sidebar Drawer styling */
.sidebar-drawer {
    position: fixed;
    top: 0;
    left: -320px;
    width: 300px;
    height: 100%;
    background: rgba(13, 18, 31, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-glass);
    z-index: 1001;
    transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 2rem 1.5rem;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.sidebar-drawer.active {
    left: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-glass);
    padding-bottom: 1rem;
}

.sidebar-header h3 {
    font-size: 1.35rem;
    font-weight: 700;
    background: linear-gradient(135deg, #ffffff, #9ca3af);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    transition: var(--transition);
}

.sidebar-close:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-body {
    flex-grow: 1;
    overflow-y: auto;
}

.sidebar-filters {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.sidebar-filter-pill {
    width: 100%;
    text-align: left;
    padding: 0.8rem 1.2rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-glass);
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.sidebar-filter-pill:hover {
    color: var(--text-primary);
    border-color: var(--border-glass-hover);
    background: rgba(255, 255, 255, 0.05);
    padding-left: 1.5rem; /* subtle nudge animation */
}

.sidebar-filter-pill.active {
    background: var(--gradient-glow);
    color: #080b11;
    border-color: transparent;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 242, 254, 0.2);
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 7, 11, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* Notice Bar styling */
.notice-bar {
    background: rgba(18, 24, 38, 0.45);
    border: 1px solid var(--border-glass);
    border-radius: 12px;
    margin: 1.5rem auto 0 auto;
    max-width: 1200px;
    width: calc(100% - 3rem);
    display: flex;
    align-items: center;
    overflow: hidden;
    padding: 0.5rem 1rem;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.notice-badge {
    background: var(--gradient-glow);
    color: #080b11;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    margin-right: 1rem;
    white-space: nowrap;
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.25);
}

.notice-marquee {
    flex-grow: 1;
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    height: 24px;
}

.notice-text {
    position: absolute;
    white-space: nowrap;
    will-change: transform;
    animation: marquee 25s linear infinite;
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-primary);
    padding-left: 100%;
}

@keyframes marquee {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-100%, 0, 0); }
}

/* Responsive adjust */
@media(max-width: 768px) {
    .navbar {
        padding: 1rem;
    }
    .hero h1 {
        font-size: 2.25rem;
    }
    .container {
        padding: 1.5rem 1rem;
    }
}

