/* ========================================
   LIQUID GLASS DESIGN - iOS Style
   ======================================== */

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

:root {
    --bg-gradient-start: #f5f5f7;
    --bg-gradient-mid: #e8e8ed;
    --bg-gradient-end: #d2d2d7;
    --glass-bg: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(255, 255, 255, 0.9);
    --glass-shadow: rgba(0, 0, 0, 0.06);
    --text-primary: #1d1d1f;
    --text-secondary: #86868b;
    --blur-amount: 40px;
    --transition-smooth: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text-primary);
    overflow-x: hidden;
}

body {
    min-height: 100vh;
    position: relative;
}

/* Background Effects - iOS Style */
.background-gradient {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 30% 20%, rgba(147, 112, 219, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(64, 156, 255, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(255, 182, 193, 0.1) 0%, transparent 60%),
        linear-gradient(180deg, #f5f5f7 0%, #e8e8ed 50%, #d2d2d7 100%);
    z-index: -2;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0.03;
    z-index: -1;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    text-align: center;
    margin-bottom: 60px;
    animation: fadeInDown 0.8s ease-out;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.title {
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 12px;
    color: #1d1d1f;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 300;
}

/* Glass Card Base - iOS Liquid Glass */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur-amount)) saturate(180%);
    -webkit-backdrop-filter: blur(var(--blur-amount)) saturate(180%);
    border: 0.5px solid var(--glass-border);
    box-shadow: 
        0 4px 30px var(--glass-shadow),
        0 1px 1px rgba(255, 255, 255, 0.8) inset,
        0 -1px 1px rgba(0, 0, 0, 0.02) inset;
    position: relative;
    overflow: hidden;
    transition: var(--transition-smooth);
}

.glass-shine {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 45%;
    background: linear-gradient(180deg, 
        rgba(255, 255, 255, 0.8) 0%, 
        rgba(255, 255, 255, 0.4) 40%,
        transparent 100%);
    pointer-events: none;
    border-radius: inherit;
}

.glass-reflection {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 25%;
    background: linear-gradient(0deg, 
        rgba(255, 255, 255, 0.3) 0%, 
        transparent 100%);
    pointer-events: none;
    border-radius: inherit;
}

/* Shape Variations */
.rounded-rect {
    border-radius: 24px;
}

.ellipse {
    border-radius: 50% / 40%;
}

.pill {
    border-radius: 100px;
}

.circle {
    border-radius: 50%;
    aspect-ratio: 1;
}

.square {
    border-radius: 8px;
}

/* Apps Grid */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 180px));
    gap: 24px;
    padding: 20px;
    flex: 1;
    align-content: start;
    justify-content: center;
    animation: fadeIn 1s ease-out 0.3s both;
}

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

/* App Card - iOS Style */
.app-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 28px 20px;
    min-height: 160px;
    min-width: 140px;
    text-decoration: none;
    color: var(--text-primary);
    cursor: pointer;
    transform-style: preserve-3d;
    perspective: 1000px;
}

.app-card:hover {
    transform: translateY(-10px) scale(1.05);
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.12),
        0 1px 1px rgba(255, 255, 255, 0.9) inset;
    border-color: rgba(255, 255, 255, 1);
}

.app-card:active {
    transform: translateY(-4px) scale(0.98);
}

/* App Icon - iOS Style */
.app-icon-wrapper {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    border-radius: 16px;
    background: linear-gradient(145deg, 
        var(--accent-color, #007AFF) 0%, 
        color-mix(in srgb, var(--accent-color, #007AFF) 80%, black) 100%);
    box-shadow: 
        0 6px 20px color-mix(in srgb, var(--accent-color, #007AFF) 40%, transparent),
        0 1px 2px rgba(255, 255, 255, 0.3) inset,
        0 -1px 2px rgba(0, 0, 0, 0.15) inset;
    transition: var(--transition-smooth);
}

/* Icon Shape Variations - iOS */
.app-icon-wrapper.icon-rounded {
    border-radius: 16px;
}

.app-icon-wrapper.icon-circle {
    border-radius: 50%;
    width: 64px;
    height: 64px;
}

.app-icon-wrapper.icon-pill {
    border-radius: 32px;
    width: 76px;
    height: 64px;
}

.app-icon-wrapper.icon-ellipse {
    border-radius: 50%;
    width: 76px;
    height: 58px;
}

.app-icon-wrapper.icon-square {
    border-radius: 12px;
}

.app-card:hover .app-icon-wrapper {
    transform: translateZ(20px) scale(1.05);
    box-shadow: 
        0 12px 28px color-mix(in srgb, var(--accent-color, #007AFF) 50%, transparent),
        0 1px 2px rgba(255, 255, 255, 0.4) inset;
}

.app-icon-wrapper i {
    font-size: 26px;
    color: white;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

/* App Name */
.app-name {
    font-size: 0.9rem;
    font-weight: 500;
    text-align: center;
    color: #1d1d1f;
    transition: var(--transition-smooth);
    letter-spacing: -0.01em;
}

.app-card:hover .app-name {
    transform: translateZ(10px);
}

.app-card:hover .app-name {
    transform: translateZ(10px);
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 40px;
    text-align: center;
}

.empty-state i {
    font-size: 4rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.empty-state .admin-link {
    color: #4285F4;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-smooth);
}

.empty-state .admin-link:hover {
    color: #5a9bff;
}

/* Footer - Icon Only Buttons */
.footer {
    display: flex;
    justify-content: center;
    gap: 16px;
    padding: 40px 20px;
    margin-top: auto;
}

.admin-btn,
.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 500;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(20px) saturate(180%);
    border: 0.5px solid rgba(255, 255, 255, 0.9);
}

.admin-btn i,
.logout-btn i {
    font-size: 1.2rem;
}

.admin-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.9);
}

.logout-btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 12px 30px rgba(255, 59, 48, 0.15);
    background: rgba(255, 59, 48, 0.1);
    color: #ff3b30;
    border-color: rgba(255, 59, 48, 0.3);
}

.admin-btn i {
    font-size: 1.1rem;
}

/* Responsive */
@media (max-width: 768px) {
    .title {
        font-size: 2.5rem;
    }
    
    .apps-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 20px;
    }
    
    .app-card {
        min-height: 150px;
        padding: 24px 16px;
    }
    
    .app-icon-wrapper {
        width: 56px;
        height: 56px;
    }
    
    .app-icon-wrapper i {
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 20px 15px;
    }
    
    .title {
        font-size: 2rem;
    }
    
    .apps-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

/* Animation for cards appearing */
.app-card {
    animation: cardAppear 0.6s ease-out backwards;
}

.app-card:nth-child(1) { animation-delay: 0.1s; }
.app-card:nth-child(2) { animation-delay: 0.15s; }
.app-card:nth-child(3) { animation-delay: 0.2s; }
.app-card:nth-child(4) { animation-delay: 0.25s; }
.app-card:nth-child(5) { animation-delay: 0.3s; }
.app-card:nth-child(6) { animation-delay: 0.35s; }
.app-card:nth-child(7) { animation-delay: 0.4s; }
.app-card:nth-child(8) { animation-delay: 0.45s; }
.app-card:nth-child(9) { animation-delay: 0.5s; }
.app-card:nth-child(10) { animation-delay: 0.55s; }

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