/* ============================================
   RESET & VARIABLES
   ============================================ */
:root {
    --primary: #6c5ce7;
    --primary-light: #a29bfe;
    --primary-dark: #5a4bd1;
    --success: #00b894;
    --danger: #ff6b6b;
    --warning: #fdcb6e;
    --bg-glass: rgba(255,255,255,0.12);
    --glass-border: rgba(255,255,255,0.18);
    --shadow-glass: 0 8px 32px rgba(0,0,0,0.15);
    --radius: 20px;
    --radius-sm: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, sans-serif;
    min-height: 100vh;
    background: #0a0a1a;
    overflow-x: hidden;
    color: white;
}

/* ============================================
   BACKGROUND ANIMATED
   ============================================ */
.bg-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    overflow: hidden;
}

.bg-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, 
        #0a0a1a 0%,
        #1a1a3e 25%,
        #2d1b4e 50%,
        #1a1a3e 75%,
        #0a0a1a 100%
    );
}

.bg-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 20s ease-in-out infinite;
}

.orb-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, #6c5ce7, transparent);
    top: -200px;
    right: -100px;
    animation-delay: 0s;
}

.orb-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #00cec9, transparent);
    bottom: -150px;
    left: -100px;
    animation-delay: -7s;
}

.orb-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, #fd79a8, transparent);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -14s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.9); }
}

/* ============================================
   APP WRAPPER
   ============================================ */
.app-wrapper {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px 20px 100px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   TOP BAR
   ============================================ */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 12px 20px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow-glass);
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.greeting {
    display: flex;
    align-items: center;
    gap: 10px;
}
.greeting-icon {
    font-size: 28px;
}
.greeting-text {
    font-size: 12px;
    font-weight: 400;
    opacity: 0.7;
    display: block;
}
.greeting-title {
    font-size: 18px;
    font-weight: 700;
    background: linear-gradient(135deg, #fff, #a29bfe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    max-width: 500px;
}

.search-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    background: var(--bg-glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 0 14px;
    transition: var(--transition);
}
.search-wrapper:focus-within {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.3);
}
.search-wrapper .search-icon {
    color: rgba(255,255,255,0.5);
    font-size: 16px;
}
.search-wrapper input {
    background: none;
    border: none;
    padding: 10px 12px;
    color: white;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    width: 100%;
    outline: none;
}
.search-wrapper input::placeholder {
    color: rgba(255,255,255,0.4);
}

.btn-add, .btn-manage {
    background: var(--bg-glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: white;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    font-size: 18px;
}
.btn-add:hover, .btn-manage:hover {
    background: rgba(255,255,255,0.2);
    transform: scale(1.05);
}

.btn-manage.active {
    background: var(--danger);
    border-color: var(--danger);
}

/* ============================================
   STATS BAR
   ============================================ */
.stats-bar {
    display: flex;
    gap: 30px;
    padding: 12px 24px;
    margin-bottom: 20px;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 10px;
}
.stat-icon {
    font-size: 18px;
    color: var(--primary-light);
    opacity: 0.7;
}
.stat-number {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary-light);
}
.stat-label {
    font-size: 13px;
    opacity: 0.6;
}

/* ============================================
   LAUNCHER GRID
   ============================================ */
.launcher-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
    flex: 1;
    padding: 4px 0 20px;
}

/* ============================================
   LAUNCHER ITEM
   ============================================ */
.launcher-item {
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 20px 14px 16px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: white;
    position: relative;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.launcher-item:hover {
    transform: translateY(-6px) scale(1.02);
    background: rgba(255,255,255,0.18);
    box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}

.launcher-item .item-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    transition: var(--transition);
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.launcher-item:hover .item-icon {
    transform: scale(1.08);
}

.launcher-item .item-name {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.launcher-item .item-desc {
    font-size: 10px;
    font-weight: 400;
    opacity: 0.4;
    letter-spacing: 0.3px;
}

.launcher-item .item-actions {
    display: none;
    position: absolute;
    top: 8px;
    right: 8px;
    gap: 4px;
}
.launcher-item.manage-mode .item-actions {
    display: flex;
}
.launcher-item .item-actions button {
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    cursor: pointer;
    transition: var(--transition);
    font-size: 13px;
}
.launcher-item .item-actions button:hover {
    transform: scale(1.1);
}
.launcher-item .item-actions .edit-action:hover {
    background: var(--primary);
}
.launcher-item .item-actions .delete-action:hover {
    background: var(--danger);
}

/* ============================================
   BOTTOM NAV
   ============================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: rgba(10, 10, 26, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    padding: 8px 0 16px;
    z-index: 100;
    max-width: 1200px;
    margin: 0 auto;
    left: 50%;
    transform: translateX(-50%);
    border-radius: var(--radius) var(--radius) 0 0;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Inter', sans-serif;
    padding: 4px 16px;
    position: relative;
    font-size: 20px;
}
.bottom-nav-item span:last-child {
    font-size: 10px;
    font-weight: 500;
}
.bottom-nav-item:hover {
    color: rgba(255,255,255,0.7);
}
.bottom-nav-item.active {
    color: var(--primary-light);
}
.bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--primary-light);
    border-radius: 3px;
}
.bottom-nav-item#navAdd.active {
    color: var(--success);
}
.bottom-nav-item#navAdd.active::before {
    background: var(--success);
}
.bottom-nav-item#navManage.active {
    color: var(--warning);
}
.bottom-nav-item#navManage.active::before {
    background: var(--warning);
}

/* ============================================
   FAB
   ============================================ */
.fab-container {
    position: fixed;
    bottom: 80px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 90;
}

.fab {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    color: white;
    font-size: 24px;
}
.fab:hover {
    transform: scale(1.08);
}
.fab-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}
.fab-danger {
    background: var(--danger);
}

/* ============================================
   MODAL
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: rgba(26, 26, 58, 0.95);
    backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 28px 32px;
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
    color: white;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}
.modal-header h2 {
    font-size: 20px;
    font-weight: 700;
}
.modal-header h2 i {
    margin-right: 10px;
    color: var(--primary-light);
}
.modal-close {
    background: rgba(255,255,255,0.08);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    transition: var(--transition);
    font-size: 18px;
}
.modal-close:hover {
    background: var(--danger);
    color: white;
}

.modal-confirm {
    text-align: center;
    max-width: 380px;
}
.confirm-icon {
    font-size: 48px;
    margin-bottom: 12px;
}
.modal-confirm h3 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}
.modal-confirm p {
    color: rgba(255,255,255,0.6);
    font-size: 15px;
    margin-bottom: 24px;
    line-height: 1.6;
}
.modal-confirm p strong {
    color: white;
}
.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}
.confirm-actions .btn {
    min-width: 100px;
    justify-content: center;
}

/* ============================================
   FORM
   ============================================ */
.form-group {
    margin-bottom: 16px;
}
.form-group label {
    display: block;
    font-weight: 500;
    font-size: 13px;
    color: rgba(255,255,255,0.7);
    margin-bottom: 4px;
}
.form-group label i {
    margin-right: 6px;
    font-size: 13px;
}
.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: white;
    transition: var(--transition);
}
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-light);
    background: rgba(255,255,255,0.1);
}
.form-group input::placeholder {
    color: rgba(255,255,255,0.3);
}
.form-group select option {
    background: #1a1a3e;
    color: white;
}
.form-group input[type="color"] {
    padding: 2px;
    height: 40px;
    cursor: pointer;
}

/* Icon Preview */
.icon-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 8px;
    padding: 8px 14px;
    background: rgba(255,255,255,0.04);
    border-radius: var(--radius-sm);
    border: 1px solid var(--glass-border);
}
.icon-preview i {
    font-size: 24px;
    color: var(--primary-light);
}
.icon-preview span {
    font-size: 12px;
    color: rgba(255,255,255,0.4);
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
.btn i {
    font-size: 16px;
}
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(108, 92, 231, 0.4);
}
.btn-secondary {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.7);
}
.btn-secondary:hover {
    background: rgba(255,255,255,0.15);
}
.btn-danger {
    background: var(--danger);
    color: white;
}
.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 107, 107, 0.4);
}

/* ============================================
   TOAST
   ============================================ */
.toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 26, 58, 0.95);
    backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
    font-weight: 500;
    font-size: 14px;
    z-index: 300;
    animation: toastIn 0.4s ease;
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    max-width: 90%;
}
.toast.success {
    border-left: 4px solid var(--success);
}
.toast.error {
    border-left: 4px solid var(--danger);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: rgba(255,255,255,0.4);
}
.empty-state i {
    font-size: 56px;
    display: block;
    margin-bottom: 12px;
    opacity: 0.5;
}
.empty-state h3 {
    font-weight: 500;
    color: rgba(255,255,255,0.6);
}
.empty-state p {
    font-size: 14px;
    margin-top: 4px;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .app-wrapper {
        padding: 12px 12px 90px;
    }
    
    .top-bar {
        padding: 10px 14px;
        flex-wrap: wrap;
    }
    .top-bar-right {
        max-width: 100%;
        flex: 1 1 100%;
        order: 3;
    }
    .search-wrapper {
        flex: 1;
    }
    
    .greeting-title {
        font-size: 15px;
    }
    .greeting-text {
        font-size: 10px;
    }
    .greeting-icon {
        font-size: 22px;
    }
    
    .launcher-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
        gap: 12px;
    }
    
    .launcher-item {
        padding: 14px 10px 12px;
        min-height: 120px;
    }
    .launcher-item .item-icon {
        width: 50px;
        height: 50px;
        font-size: 22px;
        border-radius: 14px;
    }
    .launcher-item .item-name {
        font-size: 11px;
    }
    
    .modal {
        padding: 20px;
        margin: 10px;
    }
    
    .bottom-nav {
        padding: 4px 0 12px;
    }
    .bottom-nav-item {
        padding: 2px 10px;
        font-size: 18px;
    }
    .bottom-nav-item span:last-child {
        font-size: 9px;
    }
    
    .fab-container {
        bottom: 72px;
        right: 16px;
    }
    .fab {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }
    
    .stats-bar {
        padding: 10px 16px;
        gap: 16px;
    }
    .stat-number {
        font-size: 16px;
    }
    .stat-label {
        font-size: 11px;
    }
    .stat-icon {
        font-size: 15px;
    }
}

@media (max-width: 480px) {
    .launcher-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    .launcher-item {
        min-height: 100px;
        padding: 12px 8px 10px;
    }
    .launcher-item .item-icon {
        width: 42px;
        height: 42px;
        font-size: 18px;
        border-radius: 12px;
    }
    .launcher-item .item-name {
        font-size: 10px;
    }
    
    .bottom-nav-item {
        padding: 2px 6px;
        font-size: 16px;
    }
    .bottom-nav-item span:last-child {
        font-size: 8px;
    }
}

@media (min-width: 769px) {
    .bottom-nav {
        display: none;
    }
    .fab-container {
        display: none !important;
    }
}