/* --- Global Styles & Variables --- */
:root {
    /* Existing primary colors */
    --primary-bg: #4e70df;
    --text-primary: #17335e;
    --text-secondary: #ffffff;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.1);

    /* Liquid Glass colors */
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.8);
    --glass-shadow-primary: rgba(31, 38, 135, 0.2);
    --glass-shadow-secondary: rgba(255, 255, 255, 0.3);
    --glass-after-bg: rgba(255, 255, 255, 0.1);

    /* Background Gradient - Adjusted for liquid glass aesthetic */
    --grad-1: #667eea;
    --grad-2: #9f85d6;
    --grad-3: #8bb9ff;

    /* Status colors */
    --status-active: #4ade80;
    --status-maintenance: #fbbf24;
    --status-inactive: #f87171;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif, 'Meiryo', 'メイリオ', 'Hiragino Kaku Gothic ProN', 'ヒラギノ角ゴ ProN W3', sans-serif;
}

body {
    background: linear-gradient(135deg, var(--grad-1), var(--grad-2));
    background-size: 200% 200%;
    animation: bggradient 18s ease infinite;
    color: var(--text-secondary);
    min-height: 100vh;
    padding: 2rem 1rem;
}

@keyframes bggradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

a {
    color: inherit;
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
}

/* --- Liquid Glass Effect Class --- */
.glass {
    position: relative;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(2px) saturate(180%);
    border: 0.0625rem solid rgba(255, 255, 255, 0.8);
    border-radius: 2rem;
    padding: 1.25rem;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.2), inset 0 4px 20px rgba(255, 255, 255, 0.3);
}

.glass::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2rem;
    backdrop-filter: blur(1px);
    box-shadow: inset -10px -8px 0px -11px rgba(255, 255, 255, 1),
      inset 0px -9px 0px -8px rgba(255, 255, 255, 1);
    opacity: 0.6;
    z-index: -1;
    filter: blur(1px) drop-shadow(10px 4px 6px black) brightness(115%);
    pointer-events: none;
}

/* --- Page Header --- */
.page-header {
    text-align: center;
    margin: 0 auto 2rem;
    max-width: 800px;
}

.header-content {
    position: relative;
}

.back-link {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.9rem;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.back-link:hover {
    opacity: 1;
}

.page-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.page-description {
    font-size: 1.1rem;
    opacity: 0.8;
    color: var(--text-secondary);
}

/* --- Container --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* --- Filter Section --- */
.filter-section {
    margin-bottom: 2rem;
}

.filter-title {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    text-align: center;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    justify-content: center;
}

.filter-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 1.5rem;
    padding: 0.5rem 1.2rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    backdrop-filter: blur(5px);
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.filter-btn.active {
    background: rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.2);
    font-weight: 600;
}

/* --- Apps Grid --- */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

/* --- App Card --- */
.app-card {
    position: relative;
    color: var(--text-secondary);
    transition: all 0.3s ease;
    cursor: pointer;
    overflow: hidden;
}

.app-card:hover {
    transform: translateY(-8px);
    background: rgba(255, 255, 255, 0.25);
}

.app-card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.app-icon {
    width: 60px;
    height: 60px;
    border-radius: 1rem;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.app-info {
    flex-grow: 1;
}

.app-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
    color: var(--text-secondary);
}

.app-subtitle {
    font-size: 0.9rem;
    opacity: 0.8;
    color: var(--text-secondary);
}

.app-status {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--text-secondary);
}

.app-status.active {
    background: var(--status-active);
    box-shadow: 0 0 8px var(--status-active);
}

.app-status.maintenance {
    background: var(--status-maintenance);
    box-shadow: 0 0 8px var(--status-maintenance);
}

.app-status.inactive {
    background: var(--status-inactive);
    box-shadow: 0 0 8px var(--status-inactive);
}

.app-description {
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1rem;
    opacity: 0.9;
    color: var(--text-secondary);
}

.app-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.app-tag {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    padding: 0.2rem 0.8rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.app-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    opacity: 0.8;
    color: var(--text-secondary);
}

.app-category {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.2rem 0.6rem;
    border-radius: 0.8rem;
    font-size: 0.75rem;
}

/* --- No Apps Found --- */
.no-apps {
    text-align: center;
    padding: 3rem;
    margin: 2rem auto;
    max-width: 500px;
}

.no-apps h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.no-apps p {
    opacity: 0.8;
    color: var(--text-secondary);
}

/* --- Footer --- */
footer {
    text-align: center;
    margin-top: 3rem;
    padding: 1rem;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
}

/* --- Fade In Animation --- */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s ease forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Media Queries for Responsive Design --- */
@media (max-width: 768px) {
    .page-title {
        font-size: 2rem;
    }
    
    .back-link {
        position: static;
        transform: none;
        display: block;
        margin-bottom: 1rem;
    }
    
    .apps-grid {
        grid-template-columns: 1fr;
    }
    
    .filter-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .filter-btn {
        width: 100%;
        max-width: 200px;
        text-align: center;
    }
}

@media (min-width: 1024px) {
    .apps-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    }
}