/*
Theme Name: P45 Theme
Description: Thème moderne pour P45 Activités
Version: 3.0
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ========================================
   VARIABLES & RESET
   ======================================== */
:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --radius: 16px;
    --radius-sm: 12px;
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--gray-800);
    line-height: 1.6;
}

/* ========================================
   LAYOUT
   ======================================== */
.site-wrapper { min-height: 100vh; display: flex; flex-direction: column; }

.site-header {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    padding: 16px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    animation: slideDown 0.5s ease;
}
@keyframes slideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.header-inner {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}
.site-logo img { height: 60px; width: auto; transition: transform 0.3s; }
.site-logo:hover img { transform: scale(1.05); }

.site-main { flex: 1; padding: 24px 16px 40px; }

.site-footer {
    background: rgba(0,0,0,0.2);
    padding: 20px;
    text-align: center;
    font-size: 13px;
    color: rgba(255,255,255,0.8);
}

/* ========================================
   P45 APP
   ======================================== */
.p45-app { max-width: 1000px; margin: 0 auto; animation: fadeInUp 0.6s ease; }
@keyframes fadeInUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* User Card */
.p45-user {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.6s ease 0.1s both;
}
.p45-user-info { display: flex; align-items: center; gap: 14px; }
.p45-user-avatar {
    width: 48px; height: 48px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 18px;
}
.p45-user-name { font-weight: 600; font-size: 16px; color: var(--gray-900); display: block; }
.p45-user-site {
    font-size: 12px; color: #fff; background: var(--primary);
    padding: 4px 12px; border-radius: 20px;
    display: inline-block; margin-top: 4px; font-weight: 500;
}
.p45-user-site.admin { background: linear-gradient(135deg, #ec4899 0%, #8b5cf6 100%); }
.p45-user-site.prof { background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%); }
.p45-logout {
    font-size: 14px; color: var(--gray-500);
    padding: 10px 18px; background: var(--gray-100);
    border-radius: var(--radius-sm); transition: all 0.3s; font-weight: 500;
    text-decoration: none;
}
.p45-logout:hover { background: var(--gray-200); color: var(--gray-800); transform: translateY(-2px); }

/* Date Header */
.p45-date-header {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
    color: #fff;
    border-radius: var(--radius);
    padding: 32px 24px;
    margin-bottom: 24px;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-xl);
    animation: fadeInUp 0.6s ease 0.2s both;
}
.p45-date-header::before {
    content: '';
    position: absolute;
    top: -50%; left: -50%;
    width: 200%; height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    animation: shimmer 4s infinite linear;
}
@keyframes shimmer { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
.p45-date-label {
    font-size: 13px; opacity: 0.9;
    text-transform: uppercase; letter-spacing: 0.15em;
    margin-bottom: 8px; display: block; position: relative;
}
.p45-date-value {
    font-size: 42px; font-weight: 800;
    display: block; letter-spacing: -0.02em; position: relative;
}
.p45-date-titre { font-size: 15px; opacity: 0.9; margin-top: 8px; display: block; position: relative; }

/* Messages */
.p45-message {
    padding: 16px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 14px;
    animation: fadeInUp 0.6s ease 0.3s both;
}
.p45-message.success { background: var(--success-light); color: #065f46; border: 1px solid #a7f3d0; }
.p45-message.warning { background: var(--warning-light); color: #92400e; border: 1px solid #fcd34d; }
.p45-message.info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.p45-check {
    width: 28px; height: 28px;
    background: var(--success); color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; flex-shrink: 0;
    animation: popIn 0.4s ease;
}
@keyframes popIn { 0% { transform: scale(0); } 70% { transform: scale(1.2); } 100% { transform: scale(1); } }

/* Cards Grid */
.p45-list { display: grid; grid-template-columns: 1fr; gap: 16px; }

/* Card */
.p45-card {
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.6s ease both;
    position: relative;
}
.p45-card:nth-child(1) { animation-delay: 0.1s; }
.p45-card:nth-child(2) { animation-delay: 0.15s; }
.p45-card:nth-child(3) { animation-delay: 0.2s; }
.p45-card:nth-child(4) { animation-delay: 0.25s; }
.p45-card:hover { transform: translateY(-8px) scale(1.02); box-shadow: var(--shadow-xl); }
.p45-card.inscrit { border: 3px solid var(--success); }
.p45-card.inscrit::after {
    content: '✓';
    position: absolute; top: 12px; right: 12px;
    width: 32px; height: 32px;
    background: var(--success); color: #fff;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 16px; font-weight: bold; z-index: 10;
    animation: popIn 0.4s ease;
}
.p45-card.disabled { opacity: 0.6; }
.p45-card.disabled:hover { transform: none; box-shadow: var(--shadow); }

/* Card Image */
.p45-card-image {
    height: 160px;
    background-size: cover;
    background-position: center;
    position: relative;
}
.p45-card-image::after {
    content: '';
    position: absolute; bottom: 0; left: 0; right: 0;
    height: 60%;
    background: linear-gradient(to top, rgba(0,0,0,0.4), transparent);
}
.p45-card-emoji-bg {
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.p45-card-emoji-bg span {
    font-size: 56px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
    animation: float 3s ease-in-out infinite;
}
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* Card Content */
.p45-card-content { padding: 20px; }
.p45-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.p45-card-title { font-weight: 700; font-size: 18px; color: var(--gray-900); }
.p45-card-count {
    font-size: 13px; font-weight: 700;
    color: var(--primary); background: #eef2ff;
    padding: 5px 12px; border-radius: 20px;
}
.p45-card-site {
    font-size: 12px; color: var(--gray-500);
    display: inline-flex; align-items: center; gap: 4px; margin-bottom: 10px;
}
.p45-card-site::before { content: '📍'; font-size: 11px; }
.p45-card-desc { font-size: 14px; color: var(--gray-600); margin-bottom: 16px; line-height: 1.5; }

/* Progress Bar */
.p45-card-bar {
    height: 8px; background: var(--gray-200);
    border-radius: 4px; margin-bottom: 16px; overflow: hidden;
}
.p45-card-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--success) 0%, #34d399 100%);
    border-radius: 4px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}
.p45-card-progress::after {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: progressShine 2s infinite;
}
@keyframes progressShine { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.p45-card-progress.warning { background: linear-gradient(90deg, var(--warning) 0%, #fbbf24 100%); }
.p45-card-progress.full { background: linear-gradient(90deg, var(--danger) 0%, #f87171 100%); }

/* Buttons */
.p45-btn {
    display: block; width: 100%;
    padding: 14px 20px; border: none;
    border-radius: var(--radius-sm);
    font-size: 15px; font-weight: 600;
    text-align: center; cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative; overflow: hidden;
}
.p45-btn.primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
}
.p45-btn.primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.5);
}
.p45-btn.primary::before {
    content: '';
    position: absolute; top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}
.p45-btn.primary:hover::before { left: 100%; }
.p45-btn.inscrit-btn {
    background: var(--success-light); color: #065f46;
    cursor: default; border: 2px solid var(--success);
}
.p45-btn.disabled-btn { background: var(--gray-100); color: var(--gray-400); cursor: not-allowed; }

/* Empty */
.p45-empty {
    text-align: center; padding: 60px 20px;
    background: rgba(255,255,255,0.9);
    border-radius: var(--radius);
    animation: fadeInUp 0.6s ease 0.3s both;
}
.p45-empty-icon { font-size: 64px; margin-bottom: 16px; animation: float 3s ease-in-out infinite; }
.p45-empty-text { color: var(--gray-500); font-size: 16px; }

/* ========================================
   RESPONSIVE
   ======================================== */
@media (min-width: 640px) {
    .p45-list { grid-template-columns: repeat(2, 1fr); gap: 20px; }
    .site-header { padding: 20px 24px; }
    .site-main { padding: 32px 24px 48px; }
    .p45-date-value { font-size: 48px; }
    .site-logo img { height: 70px; }
}
@media (min-width: 900px) {
    .p45-list { grid-template-columns: repeat(3, 1fr); gap: 24px; }
    .header-inner, .p45-app { max-width: 1100px; }
    .site-logo img { height: 80px; }
    .p45-card-image { height: 180px; }
}
