/* --- General Styles & Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;900&display=swap');

:root {
    --brand-blue: #3b82f6;
    --brand-purple: #8b5cf6;
    --glow-color: rgba(59, 130, 246, 0.5);
    --dark-bg: #0d1117;
    --card-bg: rgba(23, 30, 44, 0.6);
    --border-color: rgba(255, 255, 255, 0.1);
}

body { 
    font-family: 'Inter', sans-serif; 
    background-color: var(--dark-bg); 
    overflow: hidden;
    color: #e5e7eb;
    background-image: 
        radial-gradient(at 27% 37%, hsla(215, 98%, 61%, 0.15) 0px, transparent 50%),
        radial-gradient(at 97% 21%, hsla(212, 98%, 52%, 0.1) 0px, transparent 50%),
        radial-gradient(at 52% 99%, hsla(258, 97%, 57%, 0.15) 0px, transparent 50%),
        radial-gradient(at 10% 29%, hsla(253, 96%, 68%, 0.1) 0px, transparent 50%),
        radial-gradient(at 97% 96%, hsla(353, 97%, 72%, 0.1) 0px, transparent 50%),
        radial-gradient(at 33% 50%, hsla(222, 97%, 72%, 0.1) 0px, transparent 50%),
        radial-gradient(at 79% 53%, hsla(343, 97%, 72%, 0.1) 0px, transparent 50%);
    animation: background-pan 15s linear infinite;
}

@keyframes background-pan {
  0% { background-position: 0% 0%; }
  100% { background-position: 200% 200%; }
}

/* --- Entry Overlay --- */
.entry-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle, #1a202c 0%, #0d1117 100%);
    display: flex; justify-content: center; align-items: center;
    z-index: 100; transition: opacity 0.5s ease-out;
}
.entry-box {
    text-align: center; padding: 2.5rem;
    background: rgba(17, 24, 39, 0.6); backdrop-filter: blur(15px);
    border-radius: 1.5rem; border: 1px solid var(--border-color);
    animation: fadeIn 0.5s ease-out; box-shadow: 0 0 40px rgba(0,0,0,0.5);
}
#entry-title {
    background: linear-gradient(45deg, var(--brand-blue), var(--brand-purple), #ec4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: text-glow 2s ease-in-out infinite alternate;
}
@keyframes text-glow {
    from { text-shadow: 0 0 5px #fff, 0 0 10px var(--brand-blue), 0 0 15px var(--brand-blue); }
    to { text-shadow: 0 0 10px #fff, 0 0 20px var(--brand-purple), 0 0 30px var(--brand-purple); }
}
.access-code-input {
    background-color: rgba(17, 24, 39, 0.8); border: 1px solid #4B5563;
    color: white; text-align: center; font-size: 1.25rem; letter-spacing: 0.5em;
    padding: 0.75rem; border-radius: 0.75rem; outline: none; transition: all 0.3s;
}
.access-code-input:focus {
    border-color: var(--brand-blue); box-shadow: 0 0 25px var(--glow-color); transform: scale(1.05);
}

/* --- Main Layout --- */
.card { 
    background-color: var(--card-bg); border: 1px solid var(--border-color);
    backdrop-filter: blur(12px); transition: all 0.3s ease; border-radius: 1rem;
    position: relative;
    overflow: hidden;
}
.card::before {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    border-radius: 1rem;
    padding: 1px;
    background: linear-gradient(45deg, var(--brand-blue), var(--brand-purple));
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box, 
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
            mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s;
}
.card:hover::before {
    opacity: 1;
}

.btn-primary { 
    background: linear-gradient(45deg, var(--brand-blue), var(--brand-purple));
    color: white; font-weight: 600; transition: all 0.3s ease; border: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2), 0 0 10px var(--glow-color) inset;
}
.btn-primary:hover { 
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3), 0 0 20px var(--glow-color);
}

/* --- Sidebar --- */
aside { background: rgba(17, 24, 39, 0.5); }
.nav-item { 
    display: flex; align-items: center; padding: 0.75rem; border-radius: 0.75rem;
    transition: all 0.2s; overflow: hidden; border: 1px solid transparent;
}
.nav-item .nav-text {
    margin-left: 0.75rem; white-space: nowrap; opacity: 0;
    transition: opacity 0.3s 0.1s; font-weight: 500;
}
aside:hover .nav-text { opacity: 1; }
.nav-item.active { 
    background: var(--brand-blue); color: white; box-shadow: 0 0 15px var(--glow-color);
}
.nav-item:not(.active):hover { 
    background-color: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.1);
}
.text-glow { color: var(--brand-blue); text-shadow: 0 0 8px var(--glow-color); }

/* --- Composer --- */
.composer-btn {
    background-color: rgba(55, 65, 81, 0.5); border-radius: 50%;
    width: 44px; height: 44px; display: flex; justify-content: center; align-items: center;
    font-size: 1.1rem; transition: all 0.2s ease; border: 1px solid var(--border-color);
}
.composer-btn:hover {
    background-color: var(--brand-blue); color: white; transform: scale(1.1);
    box-shadow: 0 0 15px var(--glow-color);
}
.tweet-textarea {
    width: 100%; background-color: #1c2333; color: white; padding: 1rem;
    border-radius: 0.75rem; border: 1px solid #4B5563; outline: none;
    transition: all 0.3s; resize: none;
}
.tweet-textarea:focus {
    border-color: var(--brand-blue); box-shadow: 0 0 15px var(--glow-color);
}
.char-count {
    position: absolute; bottom: 0.5rem; right: 0.5rem;
    font-size: 0.75rem; color: #6b7280;
}
.tweet-preview { 
    background-color: #0d1117; 
}

/* --- Magic Menu --- */
#magic-menu-container { position: relative; }
#magic-menu {
    position: absolute; bottom: 120%; left: 50%; transform: translateX(-50%);
    display: flex; justify-content: center; align-items: center;
    width: 200px; height: 200px; pointer-events: none;
}
.magic-menu-item {
    position: absolute; background: linear-gradient(145deg, #374151, #1f2937);
    border: 1px solid #4B5563; width: 48px; height: 48px; border-radius: 50%;
    display: flex; justify-content: center; align-items: center; cursor: pointer;
    transition: all 0.3s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    pointer-events: all; box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}
.magic-menu-item:hover {
    transform: var(--transform-end) scale(1.15) !important;
    background: var(--brand-blue); box-shadow: 0 0 15px var(--glow-color);
}
#magic-button.active + #magic-menu .magic-menu-item {
    opacity: 1; transform: var(--transform-end);
}
#magic-menu .magic-menu-item { opacity: 0; transform: translate(0, 0); }

/* --- AI Chat Modal --- */
.ai-modal {
    position: absolute; top: -1rem; left: 50%; transform: translateX(-50%);
    width: 95%; max-width: 500px; background-color: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(15px); border: 1px solid var(--border-color);
    border-radius: 1rem; padding: 1.5rem; box-shadow: 0 10px 35px rgba(0, 0, 0, 0.5);
    z-index: 20; animation: fadeIn 0.3s ease-out;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.ai-chat-history {
    height: 250px; overflow-y: auto; display: flex; flex-direction: column;
    gap: 1rem; padding-right: 0.5rem;
}
.ai-message {
    padding: 0.75rem 1rem; border-radius: 1rem; max-width: 80%;
    line-height: 1.5; animation: popIn 0.3s ease-out; box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
@keyframes popIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}
.ai-message.user {
    background: linear-gradient(45deg, var(--brand-blue), #6366f1);
    color: white; align-self: flex-end; border-bottom-right-radius: 4px;
}
.ai-message.gemini {
    background-color: #4B5563; color: #E5E7EB; align-self: flex-start;
    border-bottom-left-radius: 4px;
}
.ai-message.gemini.thinking::after {
    content: '...'; display: inline-block; animation: typing 1s infinite;
}
@keyframes typing {
    0% { content: '.'; } 33% { content: '..'; } 66% { content: '...'; }
}
.add-to-tweet-btn {
    background-color: #374151; border: 1px solid #4B5563; color: #E5E7EB;
    padding: 4px 8px; font-size: 0.75rem; border-radius: 6px; margin-top: 8px;
    cursor: pointer; transition: background-color 0.2s;
}
.add-to-tweet-btn:hover { background-color: #4B5563; }

/* --- Toast Notifications --- */
#toast-container { 
    position: fixed; bottom: 20px; right: 20px; z-index: 1000;
    display: flex; flex-direction: column; gap: 10px; 
}
.toast { 
    padding: 12px 20px; border-radius: 0.75rem; color: white; font-weight: 500;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2); border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px); animation: slideIn 0.3s ease-out, fadeOut 0.5s ease-in 4.5s forwards; 
}
.toast.success { background-color: rgba(34, 197, 94, 0.5); }
.toast.info { background-color: rgba(59, 130, 246, 0.5); }
.toast.error { background-color: rgba(239, 68, 68, 0.5); }
@keyframes slideIn { 
    from { transform: translateX(100%); opacity: 0; } 
    to { transform: translateX(0); opacity: 1; } 
}
@keyframes fadeOut { 
    from { opacity: 1; } 
    to { opacity: 0; transform: translateX(100%); } 
}
