/* =========================
   RESET & BASE
========================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: #070b17;
    min-height: 100vh;
    color: #e8edf5;
    line-height: 1.6;
    overflow-x: hidden;
}

/* =========================
   BACKGROUND SYSTEM (from CasOS-Mockup)
========================= */
.background {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
}

.bg-left {
    position: absolute;
    width: 1200px;
    height: 1200px;
    left: -420px;
    top: -320px;
    border-radius: 50%;
    background: radial-gradient(
        circle at top left,
        #1f7fc4 0%,
        #0b2a4f 55%,
        #070b17 100%
    );
}

.bg-right {
    position: absolute;
    width: 1000px;
    height: 1000px;
    right: -420px;
    top: -240px;
    border-radius: 50%;
    background: linear-gradient(
        180deg,
        #5fe0ff 0%,
        #2b9fd8 100%
    );
    opacity: 0.95;
}

.bg-bottom {
    position: absolute;
    width: 520px;
    height: 520px;
    left: -160px;
    bottom: -260px;
    border-radius: 50%;
    background: linear-gradient(
        180deg,
        #2fb3ff,
        #1584d6
    );
    opacity: 0.9;
}

/* =========================
   HEADER (from CasOS-Mockup)
========================= */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    height: 72px;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(
        180deg,
        rgba(7,11,23,0.95),
        rgba(7,11,23,0.85)
    );
    backdrop-filter: blur(2px);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 22px;
    font-weight: 500;
    letter-spacing: 0.2px;
    text-decoration: none;
    color: #ffffff;
}

.brand-logo {
    width: 34px;
    height: 20px;
    position: relative;
}

.brand-logo svg {
    width: 100%;
    height: 100%;
    display: block;
}

.nav-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    border-radius: 10px;
    background: #2a2f3a;
    color: #d1d5db;
    font-size: 14px;
    text-decoration: none;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.08);
    transition: background 0.3s ease;
}

.nav-pill:hover {
    background: #3a3f4a;
}

.nav-pill-primary {
    background: linear-gradient(135deg, #1f7fc4 0%, #2b9fd8 100%);
    color: white;
    box-shadow: none;
}

.nav-pill-primary:hover {
    background: linear-gradient(135deg, #2b9fd8 0%, #5fe0ff 100%);
}

/* =========================
   CONTENT WELL
========================= */
.content-well {
    position: relative;
    z-index: 5;
}

/* =========================
   SHARED PANEL SYSTEM
   Dark polished panels with strong readability
========================= */

/* Base card — solid dark with subtle border */
.panel {
    background: #0f1524;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.35);
}

.panel-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 24px;
    color: #f0f4fc;
}

/* Section card — slightly lighter for secondary grouping */
.panel-secondary {
    background: #141c2e;
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 20px;
}

/* Inline card for items within a panel */
.panel-item {
    background: #1a2438;
    border: 1px solid rgba(255,255,255,0.05);
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 10px;
}

/* =========================
   SHARED FORM ELEMENTS
========================= */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #c8d0dc;
    font-size: 0.9rem;
}

.form-input {
    width: 100%;
    padding: 11px 14px;
    background: #1a2438;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: #e8edf5;
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: #2b9fd8;
    background: #1e2a40;
    box-shadow: 0 0 0 2px rgba(43,159,216,0.15);
}

.form-input::placeholder {
    color: rgba(200,208,220,0.35);
}

.form-input-accent {
    border-left: 3px solid #1f7fc4;
}

select.form-input option {
    background: #0f1524;
    color: #e8edf5;
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

/* =========================
   SHARED BUTTONS
========================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
    line-height: 1.2;
}

.btn-primary {
    background: linear-gradient(135deg, #1f7fc4 0%, #2b9fd8 100%);
    color: white;
    box-shadow: 0 2px 12px rgba(31,127,196,0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2b9fd8 0%, #5fe0ff 100%);
    box-shadow: 0 4px 16px rgba(31,127,196,0.3);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, #1e8e3e 0%, #28a745 100%);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #28a745 0%, #34ce57 100%);
    transform: translateY(-1px);
}

.btn-ghost {
    background: rgba(255,255,255,0.06);
    color: #c8d0dc;
    border: 1px solid rgba(255,255,255,0.1);
}

.btn-ghost:hover {
    background: rgba(255,255,255,0.1);
    color: #e8edf5;
}

.btn-danger {
    background: transparent;
    color: #e74c5e;
    border: 1px solid #e74c5e;
}

.btn-danger:hover {
    background: #e74c5e;
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 8px;
}

.btn-icon {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: 50%;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* =========================
   SHARED TOOLTIP / STATE
========================= */
.success-flash {
    animation: flashGreen 0.3s ease-in-out;
}

@keyframes flashGreen {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

.text-muted {
    color: rgba(200,208,220,0.55);
}

.text-warning {
    color: #f0c040;
}

.text-accent {
    color: #5fe0ff;
}

/* =========================
   PROGRESS BAR (shared)
========================= */
.progress-container {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 100;
}

.progress-step {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    transition: all 0.3s ease;
}

.progress-step.active {
    background: #2b9fd8;
    transform: scale(1.25);
    box-shadow: 0 0 8px rgba(43,159,216,0.5);
}

.progress-step.completed {
    background: #1e8e3e;
}

/* =========================
   RESPONSIVE
========================= */
@media (max-width: 768px) {
    .header {
        padding: 0 16px;
    }

    .brand {
        font-size: 18px;
    }

    .nav-pill {
        padding: 4px 10px;
        font-size: 12px;
    }

    .panel {
        padding: 20px;
    }
}

/* =========================
   APPLICATION NOTICE (Consent & Persistence)
========================= */
.app-notice {
    position: fixed;
    bottom: 80px; /* Offset from progress dots at 20px */
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 440px;
    background: #0f1524;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 24px;
    z-index: 2000;
    display: none; /* Controlled by JS to prevent flash */
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    animation: slideUpCenter 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

@keyframes slideUpCenter {
    from { transform: translate(-50%, 20px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

.app-notice-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.app-notice-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
}

.app-notice-text {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.7);
    line-height: 1.5;
}

.app-notice-text a {
    color: #5fe0ff;
    text-decoration: none;
}

.app-notice-options {
    padding-top: 4px;
}

.app-notice-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.app-notice-switch input[type="checkbox"] {
    accent-color: #2b9fd8;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.app-notice-switch-text {
    font-size: 0.9rem;
    color: #e8edf5;
}

.app-notice-actions {
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 768px) {
    .app-notice {
        bottom: 70px;
        width: calc(100% - 32px);
        padding: 20px;
    }
}

/* =========================
   SAVED APPLICATIONS
   ========================= */

/* Grid layout */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.apps-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Card styling */
.app-card {
    background: #121729;
    border: 1px solid #2a3050;
    border-radius: 10px;
    padding: 20px;
    transition: border-color 0.2s;
}

.app-card:hover {
    border-color: #3a4570;
}

.app-card-header {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 12px;
}

.app-card-icon {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    background: #1a1f35;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    flex-shrink: 0;
    overflow: hidden;
}

.app-card-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 10px;
}

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

.app-card-info h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0 0 4px;
}

.app-card-info .tagline {
    font-size: 0.85rem;
    color: #8b95ad;
    margin: 0 0 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-card-info .meta {
    font-size: 0.75rem;
    color: #5a6580;
}

.app-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.app-card-actions button {
    padding: 6px 14px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

/* Starred carousel */
.starred-section {
    margin-bottom: 32px;
}

.starred-section h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: #8b95ad;
    margin-bottom: 12px;
}

.starred-row-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.starred-row {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 8px 4px 16px;
    -ms-overflow-style: none;
    scrollbar-width: none;
    flex: 1;
}

.starred-row::-webkit-scrollbar {
    display: none;
}

.star-scroll-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #1e90ff;
    background: transparent;
    color: #1e90ff;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
    z-index: 1;
}

.star-scroll-btn:hover {
    background: #1e90ff;
    color: #fff;
}

.star-card {
    min-width: 200px;
    max-width: 200px;
    background: #121729;
    border: 1px solid #2a3050;
    border-radius: 10px;
    padding: 16px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.star-card:hover {
    border-color: #1e90ff;
}

.star-card .star-icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #1a1f35;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.star-card .star-title {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.star-card .star-category {
    font-size: 0.75rem;
    color: #8b95ad;
}

/* Export modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: #121729;
    border: 1px solid #2a3050;
    border-radius: 12px;
    padding: 32px;
    max-width: 500px;
    width: 90%;
}

.modal-content h2 {
    font-size: 1.3rem;
    margin-bottom: 16px;
}

.modal-content p {
    color: #8b95ad;
    line-height: 1.6;
    margin-bottom: 12px;
}

.modal-content code {
    background: #1a1f35;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #5fe0ff;
}

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

.modal-actions button {
    padding: 8px 20px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: #1a1f35;
    border: 1px solid #2a3050;
    color: #c8d0dc;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 0.9rem;
    z-index: 2000;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* View toggle */
.view-toggle {
    display: flex;
    gap: 0;
    border: 1px solid #2a3050;
    border-radius: 6px;
    overflow: hidden;
}

.view-toggle button {
    background: transparent;
    border: none;
    color: #8b95ad;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.view-toggle button.active {
    background: #1e90ff;
    color: #fff;
}

.view-toggle button:not(.active):hover {
    background: #1a1f35;
    color: #c8d0dc;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #8b95ad;
}

.empty-state h2 {
    font-size: 1.4rem;
    margin-bottom: 12px;
    color: #c8d0dc;
}

.empty-state p {
    margin-bottom: 20px;
}
