/* static/css/style.css */

:root {
    /* --- GLOBAL DEFAULTS --- */
    --bg-color: #FAFAFA;
    --card-bg: #FFFFFF;
    --text-main: #171717;
    --text-muted: #737373;
    --border-color: rgba(0, 0, 0, 0.06);
    
    /* DEFAULT THEME (Neutral) */
    --theme-color: #171717; 
    
    --shadow: 0 4px 20px rgba(0,0,0,0.03);
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* DARK MODE */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0A0A0A;
        --card-bg: #171717;
        --text-main: #EDEDED;
        --text-muted: #A1A1AA;
        --border-color: rgba(255, 255, 255, 0.1);
        --theme-color: #EDEDED;
    }
}

/* --- RESET & LAYOUT --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    display: flex; flex-direction: column; min-height: 100vh;
}

.container { max-width: 1000px; margin: 0 auto; padding: 0 24px; width: 100%; }
.main-content { flex: 1; padding-bottom: 60px; }

/* --- NAVBAR (Cleaner, No Border) --- */
nav {
    padding: 40px 0 20px 0; /* More top padding for breathing room */
    display: flex; justify-content: space-between; align-items: center;
    /* Removed border-bottom */
}

/* Standalone App Brand */
.brand {
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: -0.03em;
    color: var(--text-main);
    text-decoration: none;
    display: flex; align-items: center; gap: 10px;
}

.nav-link {
    font-size: 0.9rem; color: var(--text-muted); text-decoration: none; margin-left: 24px;
    transition: color 0.2s;
}
.nav-link:hover { color: var(--text-main); }

/* --- HERO HEADERS --- */
.hero-section { padding: 60px 0 80px 0; max-width: 700px; }
.hero-title {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.1;
    margin-bottom: 16px;
    color: var(--text-main);
}
.hero-subtitle { font-size: 1.25rem; color: var(--text-muted); font-weight: 400; }

/* --- GRID & CARDS --- */
.apps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px; }

.app-card {
    background: var(--card-bg); padding: 32px; border-radius: 16px;
    box-shadow: var(--shadow); border: 1px solid var(--border-color);
    text-decoration: none; color: inherit; display: block;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s;
    height: 100%; display: flex; flex-direction: column;
}
.app-card:hover { transform: translateY(-4px); box-shadow: 0 12px 30px rgba(0,0,0,0.06); border-color: transparent; }

.app-icon { 
    width: 48px; height: 48px; border-radius: 12px; margin-bottom: 20px;
    display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
}
.app-name-card { font-weight: 700; font-size: 1.1rem; margin-bottom: 8px; }
.app-desc { font-size: 0.95rem; color: var(--text-muted); margin-bottom: 24px; }
.status-pill {
    margin-top: auto; font-size: 0.75rem; font-weight: 600; padding: 4px 12px;
    border-radius: 99px; background-color: var(--border-color); color: var(--text-muted); width: fit-content;
}

/* --- FOOTER --- */
footer {
    border-top: 1px solid var(--border-color);
    padding: 40px 0; margin-top: auto;
    text-align: center; font-size: 0.85rem; color: var(--text-muted);
}
.footer-link { color: var(--text-main); font-weight: 500; text-decoration: none; }
.footer-link:hover { text-decoration: underline; }


/* --- FORMS & INPUTS --- */
.auth-container {
    max-width: 400px;
    margin: 40px auto;
}

/* Reusing the card style for the form container */
.auth-card {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.form-group { margin-bottom: 20px; }

label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
}

/* Beautiful, minimal inputs */
input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    font-size: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--bg-color); /* Slight contrast from card */
    color: var(--text-main);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

input:focus {
    border-color: var(--theme-color);
    box-shadow: 0 0 0 3px rgba(0,0,0,0.05); /* Subtle glow */
}

/* --- BUTTONS --- */
.btn {
    display: inline-flex; justify-content: center; align-items: center;
    padding: 12px 24px; border-radius: 8px; font-weight: 600; font-size: 0.95rem;
    border: none; cursor: pointer; text-decoration: none; transition: opacity 0.2s;
}

.btn-primary {
    background-color: var(--theme-color); /* <--- Use the dynamic variable! */
    color: #FFFFFF; /* Force white text so it looks good on Indigo/Amber */
    width: 100%;
}

.btn-primary:hover { opacity: 0.9; }

/* In dark mode, we might want the button to be white text on dark, or inverted. 
   Currently var(--text-main) is white in dark mode, so btn-primary becomes white button with black text.
   This looks great. */

.auth-footer {
    margin-top: 24px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.auth-link { color: var(--text-main); text-decoration: underline; }

/* --- PROFILE PAGE SPECIFIC --- */
.profile-header {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 40px;
    background: var(--card-bg);
    padding: 32px;
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.profile-avatar-placeholder {
    width: 80px; height: 80px;
    background-color: var(--pill-bg);
    color: var(--text-muted);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; font-weight: 700;
}

/* The "Inactive" State for Apps */
.app-card.inactive {
    opacity: 0.6;
    background-color: transparent; /* Blends with background */
    border-style: dashed;
    box-shadow: none;
    cursor: pointer; /* Still clickable so they can sign up */
}

.app-card.inactive:hover {
    opacity: 1;
    border-style: solid;
    background-color: var(--card-bg);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.app-card.inactive .app-icon {
    filter: grayscale(100%); /* Removes all color */
    background-color: #e5e5e5 !important; /* Forces gray bg */
    color: #737373 !important; /* Forces gray text */
}

/* --- USER ACCOUNT DROPDOWN --- */

/* 1. The Container */
.user-dropdown {
    position: relative; /* Anchor for the absolute menu */
    display: inline-block;
}

/* 2. The Avatar Circle (Trigger) */
.user-avatar {
    width: 36px;
    height: 36px;
    background-color: var(--text-main);
    color: var(--bg-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.user-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 0 0 4px rgba(0,0,0,0.05);
}

/* 3. The Menu (Hidden) */
.dropdown-menu {
    display: none; /* Hidden by default */
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 10px; /* Space between icon and menu */
    background-color: var(--bg-color);
    min-width: 200px;
    box-shadow: 0 4px 25px rgba(0,0,0,0.15);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    z-index: 1000;
    overflow: hidden;
}

/* 4. Show Menu on Hover */
/* Note: We use the parent .user-dropdown:hover so the menu stays open when you move mouse to it */
.user-dropdown:hover .dropdown-menu,
.user-dropdown:focus-within .dropdown-menu {
    display: block;
}

/* 5. Menu Items */
.dropdown-header {
    padding: 12px 16px;
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-main);
    font-size: 0.9rem;
    text-decoration: none;
}

.dropdown-item:hover {
    background-color: var(--card-bg);
}

/* Red text for Sign Out */
.dropdown-item.delete-item {
    color: #dc2626;
}

/* FIX for Dropdown closing too fast */

/* 1. Add an invisible bridge to connect the avatar to the menu */
.dropdown-menu::before {
    content: "";
    position: absolute;
    /* Move this invisible block UP to fill the gap */
    top: -15px; 
    left: 0;
    width: 100%;
    height: 20px; 
    background: transparent; /* It's invisible */
}

/* 2. (Optional) Make the menu appear closer if it's still too far */
.dropdown-menu {
    /* Change the margin from 10px to 8px or less if needed */
    margin-top: 8px; 
}
