/* ============================================
   Variables CSS
   ============================================ */
:root {
    --crf-red: #E30613;
    --crf-red-dark: #B00510;
    --crf-red-light: #FF0E1B;
    --background: #F5F5F7;
    --card-background: #FFFFFF;
    --text-primary: #1D1D1F;
    --text-secondary: #6E6E73;
    --border-color: #D2D2D7;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.16);
    --radius: 16px;
    --radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================
   Reset & Base
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   Container
   ============================================ */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ============================================
   Header
   ============================================ */
.header {
    padding: 32px 0;
    margin-bottom: 40px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    height: 70px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.logo-image {
    height: 100%;
    width: auto;
    object-fit: contain;
}

.logo-text h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.logo-text p {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============================================
   Search
   ============================================ */
.search-container {
    flex: 1;
    max-width: 500px;
}

.search-input {
    width: 100%;
    padding: 14px 20px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-family: inherit;
    background: var(--card-background);
    transition: var(--transition);
    outline: none;
}

.search-input:focus {
    border-color: var(--crf-red);
    box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.1);
}

.search-input::placeholder {
    color: var(--text-secondary);
}

/* ============================================
   Auth Section
   ============================================ */
.auth-section {
    display: flex;
    align-items: center;
}

.auth-button {
    padding: 12px 24px;
    background: var(--crf-red);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
}

.auth-button:hover {
    background: var(--crf-red-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.auth-button:active {
    transform: translateY(0);
}

/* ============================================
   Main Content
   ============================================ */
.main-content {
    flex: 1;
    margin-bottom: 60px;
}

.section-header {
    margin-bottom: 32px;
}

.section-header h2 {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.section-description {
    font-size: 15px;
    color: var(--text-secondary);
}

/* ============================================
   Apps Grid
   ============================================ */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}

.app-card {
    background: var(--card-background);
    border-radius: var(--radius);
    padding: 28px;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.app-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--crf-red), var(--crf-red-light));
    transform: scaleX(0);
    transform-origin: left;
    transition: var(--transition);
}

.app-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: transparent;
}

.app-card:hover::before {
    transform: scaleX(1);
}

.app-card:active {
    transform: translateY(-2px);
}

/* État verrouillé */
.app-card.locked {
    filter: grayscale(0.5);
    opacity: 0.85;
}

.app-card.locked:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
}

.lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border-radius: var(--radius);
    transition: all 0.3s ease;
}

.app-card.locked:hover .lock-overlay {
    background: rgba(0, 0, 0, 0.75);
}

.lock-icon {
    font-size: 56px;
    margin-bottom: 12px;
    animation: lockBounce 2s ease-in-out infinite;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

@keyframes lockBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.lock-text {
    font-size: 16px;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
}

.app-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    font-size: 28px;
    transition: var(--transition);
}

.app-card:hover .app-icon {
    transform: scale(1.05);
}

.app-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.app-description {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 16px;
}

.app-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: var(--text-secondary);
}

.app-status {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-online .status-dot {
    background: #34C759;
    box-shadow: 0 0 0 2px rgba(52, 199, 89, 0.2);
}

.status-offline .status-dot {
    background: #FF3B30;
    box-shadow: 0 0 0 2px rgba(255, 59, 48, 0.2);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transition: var(--transition);
}

.status-dot.offline {
    background: #FF3B30;
}

.app-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--crf-red);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.app-link:hover {
    color: var(--crf-red-dark);
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-icon {
    width: 80px;
    height: 80px;
    color: var(--text-secondary);
    margin: 0 auto 20px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 16px;
    color: var(--text-secondary);
}

/* ============================================
   Footer
   ============================================ */
.footer {
    padding: 24px 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.footer p {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .search-container {
        width: 100%;
        max-width: 100%;
    }

    .apps-grid {
        grid-template-columns: 1fr;
    }

    .logo-text h1 {
        font-size: 24px;
    }

    .section-header h2 {
        font-size: 24px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }

    .header {
        padding: 20px 0;
        margin-bottom: 24px;
    }

    .app-card {
        padding: 20px;
    }
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.app-card {
    animation: fadeIn 0.5s ease-out backwards;
}

.app-card:nth-child(1) { animation-delay: 0.05s; }
.app-card:nth-child(2) { animation-delay: 0.1s; }
.app-card:nth-child(3) { animation-delay: 0.15s; }
.app-card:nth-child(4) { animation-delay: 0.2s; }
.app-card:nth-child(5) { animation-delay: 0.25s; }
.app-card:nth-child(6) { animation-delay: 0.3s; }
