/* css/tier-styles.css - Complete Secure Tier System Styles */

/* ================================
   CRITICAL SECURITY STYLES
   These ensure content is hidden by default
   ================================ */

/* Hide ALL tier-restricted CONTENT by default (but NOT navigation) */
[data-tier] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
    position: absolute !important;
    left: -9999px !important;
}

/* ================================
   NAVIGATION VISIBILITY
   Let JavaScript control navigation visibility
   ================================ */

/* Remove the blanket hiding - JavaScript will control this */
.tier-nav {
    /* Navigation visibility controlled by JavaScript */
    transition: opacity 0.3s ease;
}

/* ================================
   TIER-BASED BODY CLASSES
   Applied dynamically based on user tier
   ================================ */

/* Public tier (not logged in) */
body.tier-public [data-tier="public"] {
    display: initial !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    position: relative !important;
    left: auto !important;
}

/* Hide all tier nav for public users */
body.tier-public .tier-nav {
    display: none !important;
}

/* Authenticated tier */
body.tier-authenticated [data-tier="public"],
body.tier-authenticated [data-tier="authenticated"] {
    display: initial !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    position: relative !important;
    left: auto !important;
}

/* Show only dashboard for authenticated */
body.tier-authenticated .auth-nav {
    display: inline-block !important;
    visibility: visible !important;
}

body.tier-authenticated .family-nav,
body.tier-authenticated .girlfriend-nav,
body.tier-authenticated .admin-nav {
    display: none !important;
}

/* Family tier */
body.tier-family [data-tier="public"],
body.tier-family [data-tier="authenticated"],
body.tier-family [data-tier="family"] {
    display: initial !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    position: relative !important;
    left: auto !important;
}

/* Show dashboard and family for family tier */
body.tier-family .auth-nav,
body.tier-family .family-nav {
    display: inline-block !important;
    visibility: visible !important;
}

body.tier-family .girlfriend-nav,
body.tier-family .admin-nav {
    display: none !important;
}

/* Girlfriend tier */
body.tier-girlfriend [data-tier="public"],
body.tier-girlfriend [data-tier="authenticated"],
body.tier-girlfriend [data-tier="family"],
body.tier-girlfriend [data-tier="girlfriend"] {
    display: initial !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    position: relative !important;
    left: auto !important;
}

/* Show dashboard, family, and girlfriend for girlfriend tier */
body.tier-girlfriend .auth-nav,
body.tier-girlfriend .family-nav,
body.tier-girlfriend .girlfriend-nav {
    display: inline-block !important;
    visibility: visible !important;
}

body.tier-girlfriend .admin-nav {
    display: none !important;
}

/* Admin tier - SHOW EVERYTHING */
body.tier-admin [data-tier] {
    display: initial !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    position: relative !important;
    left: auto !important;
}

/* Admin sees ALL navigation */
body.tier-admin .tier-nav,
body.tier-admin .auth-nav,
body.tier-admin .family-nav,
body.tier-admin .girlfriend-nav,
body.tier-admin .admin-nav {
    display: inline-block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* ================================
   TIER BADGE STYLES
   Visual indicators for user tier
   ================================ */

.user-tier-indicator {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-left: 10px;
}

.tier-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: capitalize;
}

/* Tier-specific badge colors */
.tier-badge.tier-authenticated,
.user-tier-indicator.tier-authenticated {
    background: #e3f2fd;
    color: #1976d2;
}

.tier-badge.tier-family,
.user-tier-indicator.tier-family {
    background: #f3e5f5;
    color: #7b1fa2;
}

.tier-badge.tier-girlfriend,
.user-tier-indicator.tier-girlfriend {
    background: #fce4ec;
    color: #d63384;
}

.tier-badge.tier-admin,
.user-tier-indicator.tier-admin {
    background: #ffebee;
    color: #c62828;
}

/* ================================
   LOADING STATES
   Show while checking permissions
   ================================ */

.tier-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    font-size: 1.2rem;
    color: #666;
}

.tier-loading::before {
    content: '';
    display: inline-block;
    width: 30px;
    height: 30px;
    margin-right: 15px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #617140;
    border-radius: 50%;
    animation: tier-spin 1s linear infinite;
}

@keyframes tier-spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ================================
   ACCESS DENIED STYLES
   Shown when user lacks permissions
   ================================ */

.access-denied {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #f5f5f5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.access-denied-content {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    max-width: 450px;
    width: 90%;
}

.access-denied-icon {
    font-size: 4rem;
    color: #d32f2f;
    margin-bottom: 20px;
}

.access-denied h1 {
    color: #d32f2f;
    font-size: 2rem;
    margin-bottom: 15px;
}

.access-denied p {
    color: #666;
    margin-bottom: 30px;
    line-height: 1.6;
}

.access-denied-tier {
    font-weight: 600;
    color: #333;
    text-transform: capitalize;
}

.access-denied-button {
    display: inline-block;
    padding: 12px 30px;
    background: #617140;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.access-denied-button:hover {
    background: #4a5a30;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(97, 113, 64, 0.3);
}

/* ================================
   TIER-SPECIFIC CONTENT STYLES
   Visual differentiation by tier
   ================================ */

/* Authenticated content highlight */
[data-tier="authenticated"] {
    border-left: 3px solid #1976d2;
}

/* Family content highlight */
[data-tier="family"] {
    border-left: 3px solid #7b1fa2;
}

/* Girlfriend content highlight */
[data-tier="girlfriend"] {
    border-left: 3px solid #d63384;
}

/* Admin content highlight */
[data-tier="admin"] {
    border-left: 3px solid #c62828;
}

/* ================================
   RESPONSIVE TIER STYLES
   ================================ */

@media (max-width: 768px) {

    /* On mobile, show appropriate tier nav based on body class */
    body.tier-authenticated .auth-nav,
    body.tier-family .family-nav,
    body.tier-girlfriend .girlfriend-nav,
    body.tier-admin .admin-nav {
        display: block !important;
        width: 100%;
        text-align: center;
        margin: 5px 0;
    }

    .user-tier-indicator {
        display: block;
        margin: 10px 0 0 0;
        text-align: center;
    }
}

/* ================================
   SECURITY ANIMATIONS
   Visual feedback for security events
   ================================ */

@keyframes security-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(214, 51, 132, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(214, 51, 132, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(214, 51, 132, 0);
    }
}

.security-check {
    animation: security-pulse 2s infinite;
}

/* ================================
   PRINT STYLES
   Hide sensitive content when printing
   ================================ */

@media print {

    [data-tier="family"],
    [data-tier="girlfriend"],
    [data-tier="admin"],
    .tier-nav,
    .user-info {
        display: none !important;
    }
}

/* ================================
   ACCESSIBILITY
   Ensure screen readers handle tiers properly
   ================================ */

[data-tier][aria-hidden="true"] {
    display: none !important;
}

[data-tier]:not([aria-hidden="true"]):focus {
    outline: 2px solid #617140;
    outline-offset: 2px;
}

/* ================================
   SPECIAL ADMIN STYLING
   Make admin navigation stand out
   ================================ */

body.tier-admin .admin-nav {
    background: linear-gradient(135deg, #c62828 0%, #8e0000 100%);
    color: white !important;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    margin-left: 10px;
    transition: all 0.3s ease;
}

body.tier-admin .admin-nav:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(198, 40, 40, 0.3);
}

/* ================================
   DEBUG MODE (Remove in production)
   Uncomment to visualize tier restrictions
   ================================ */

/*
.debug-tiers [data-tier] {
    position: relative !important;
    opacity: 0.3 !important;
    border: 2px dashed red !important;
}

.debug-tiers [data-tier]::before {
    content: attr(data-tier) " content";
    position: absolute;
    top: 0;
    right: 0;
    background: red;
    color: white;
    padding: 2px 8px;
    font-size: 12px;
    z-index: 9999;
}
*/