:root {
    --bg-dark: #0a0a0f;
    --accent-glow: rgba(108, 92, 231, 0.5);
    --accent-color: #6c5ce7;
    --accent-secondary: #00d2d1;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --card-hover: rgba(255, 255, 255, 0.08);
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-primary);
    font-family: 'Tajawal', sans-serif;
    min-height: 100vh;
    /* Soft cosmic background glow */
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(108, 92, 231, 0.15), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(0, 210, 211, 0.15), transparent 25%);
    background-attachment: fixed;
    overflow-x: hidden;
}

/* Top Navigation for Language */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem 0;
    position: absolute;
    width: 100%;
    z-index: 20;
    gap: 1rem;
    flex-wrap: wrap;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.lang-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.5rem 1.5rem;
    border-radius: 50px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.lang-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px var(--accent-glow);
}

/* Header & Glassmorphism Logo */
.glass-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4rem 1rem 3rem;
    text-align: center;
    position: relative;
    z-index: 10;
}

.logo-container {
    margin-bottom: 2.5rem;
}

.glass-logo {
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 1.5rem 4rem;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4),
                inset 0 0 25px rgba(255, 255, 255, 0.05);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

.header-logo-img {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    object-fit: cover;
    filter: drop-shadow(0 0 12px rgba(108, 92, 231, 0.6));
    animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
    0%, 100% { filter: drop-shadow(0 0 12px rgba(108, 92, 231, 0.6)); }
    50% { filter: drop-shadow(0 0 20px rgba(0, 210, 211, 0.8)); }
}

/* Glass shine animation */
.glass-logo::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 50%; height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.15), transparent);
    transform: skewX(-25deg);
    animation: shine 5s infinite;
}

@keyframes shine {
    0% { left: -100%; }
    20% { left: 200%; }
    100% { left: 200%; }
}

.glass-logo:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 45px 0 rgba(108, 92, 231, 0.4),
                inset 0 0 30px rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
}

.logo-text {
    font-family: 'Outfit', sans-serif;
    font-size: 4rem;
    font-weight: 800;
    letter-spacing: 6px;
    /* Holographic gradient text */
    background: linear-gradient(135deg, #ffffff, #e0e0e0, var(--accent-secondary), var(--accent-color));
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 6s ease infinite;
    text-shadow: 0 0 35px rgba(255, 255, 255, 0.15);
}

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

header h1 {
    font-size: 2.8rem;
    margin-bottom: 1rem;
    font-weight: 800;
    text-shadow: 0 0 20px rgba(0,0,0,0.5);
}

header p {
    color: var(--text-secondary);
    font-size: 1.2rem;
    max-width: 650px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Container, Search & Toggles */
.container {
    max-width: 1250px;
    margin: 0 auto;
    padding: 0 2rem 5rem;
}

.search-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 4rem;
    gap: 1.5rem;
}

.search-bar {
    width: 100%;
    display: flex;
    justify-content: center;
}

.search-bar input {
    width: 100%;
    max-width: 550px;
    padding: 1.2rem 2rem;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    font-size: 1.1rem;
    font-family: 'Tajawal', sans-serif;
    backdrop-filter: blur(12px);
    transition: all 0.3s ease;
    outline: none;
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
}

.search-bar input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.search-bar input:focus {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(108, 92, 231, 0.6);
    box-shadow: 0 0 25px rgba(108, 92, 231, 0.25);
    transform: translateY(-2px);
}

.view-toggles {
    display: flex;
    gap: 1rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.5rem;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}

.toggle-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: 'Tajawal', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-btn:hover {
    color: var(--text-primary);
}

.toggle-btn.active {
    background: rgba(108, 92, 231, 0.2);
    color: var(--text-primary);
    box-shadow: 0 0 15px rgba(108, 92, 231, 0.3);
    border: 1px solid rgba(108, 92, 231, 0.3);
}

/* Grid & Cards */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2.5rem;
}

.tool-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem 2rem;
    text-align: center;
    text-decoration: none;
    color: var(--text-primary);
    backdrop-filter: blur(12px);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Inner glow border effect on hover */
.tool-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 24px;
    padding: 2px;
    background: linear-gradient(135deg, rgba(255,255,255,0.4) 0%, rgba(255,255,255,0) 100%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0.1;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.tool-card:hover {
    transform: translateY(-12px);
    background: var(--card-hover);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5),
                0 0 30px rgba(108, 92, 231, 0.15);
    border-color: rgba(108, 92, 231, 0.3);
}

.tool-card:hover::after {
    opacity: 0.8;
}

.tool-logo-wrapper {
    width: 85px;
    height: 85px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.8rem;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.06);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.3s ease;
}

.tool-card:hover .tool-logo-wrapper {
    transform: scale(1.15) rotate(8deg);
    background: rgba(255, 255, 255, 0.08);
}

.tool-name {
    font-family: 'Outfit', sans-serif;
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 0.8rem;
    letter-spacing: 0.5px;
}

.tool-category {
    font-size: 0.9rem;
    color: var(--text-primary);
    background: rgba(108, 92, 231, 0.2);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    margin-bottom: 1.2rem;
    border: 1px solid rgba(108, 92, 231, 0.3);
    font-weight: 700;
}

.tool-desc {
    font-size: 1rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Typographic icon for generated logos */
.text-icon {
    font-family: 'Outfit', sans-serif;
    font-size: 2.2rem;
    font-weight: 800;
    color: #fff;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.tool-logo {
    width: 55px;
    height: 55px;
    object-fit: contain;
    border-radius: 12px;
    transition: transform 0.3s ease;
}

/* List View Styles */
.tools-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.tools-list .tool-card {
    flex-direction: row;
    align-items: center;
    text-align: start; /* Supports both RTL and LTR smoothly */
    padding: 1.5rem 2rem;
    justify-content: space-between;
    gap: 2rem;
}

.tools-list .tool-card:hover {
    transform: translateX(-8px);
}

.tools-list .tool-logo-wrapper {
    margin-bottom: 0;
    flex-shrink: 0;
    width: 70px;
    height: 70px;
}

.tools-list .tool-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.tools-list .tool-name {
    margin-bottom: 0.3rem;
}

.tools-list .tool-category {
    align-self: flex-start;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    padding: 0.2rem 0.8rem;
}

.tools-list .tool-desc {
    max-width: 800px;
    font-size: 1.05rem;
}

/* Footer & Signature */
footer {
    padding: 3rem 2rem 2.5rem;
    margin-top: 2rem;
}

.glass-footer {
    width: 100%;
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.5rem;
    max-width: 1250px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 1.5rem 2.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25), inset 0 0 15px rgba(255, 255, 255, 0.03);
}

/* Footer Brand (Logo + AXON name) */
.footer-brand {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    text-decoration: none;
}

.footer-logo-img {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: cover;
    filter: drop-shadow(0 0 8px rgba(108, 92, 231, 0.5));
    transition: filter 0.3s ease;
}

.footer-brand:hover .footer-logo-img {
    filter: drop-shadow(0 0 14px rgba(0, 210, 211, 0.8));
}

.footer-brand-name {
    font-family: 'Outfit', sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 3px;
    background: linear-gradient(135deg, #ffffff, var(--accent-secondary), var(--accent-color));
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 6s ease infinite;
}

/* Signature */
.signature {
    color: var(--text-secondary);
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    letter-spacing: 1px;
}

.signature .highlight {
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Social / Support Links */
.social-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.social-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 1.3rem;
    border-radius: 50px;
    text-decoration: none;
    font-family: 'Outfit', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    border: 1px solid transparent;
    transition: all 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.support-btn {
    background: rgba(108, 92, 231, 0.12);
    color: var(--accent-secondary);
    border-color: rgba(108, 92, 231, 0.3);
}

.support-btn:hover {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.25), rgba(0, 210, 211, 0.25));
    border-color: var(--accent-secondary);
    color: #fff;
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(108, 92, 231, 0.35);
}

/* Responsive Styles */
@media (max-width: 768px) {
    header h1 { font-size: 2.2rem; }
    .logo-text { font-size: 3rem; }
    .glass-logo { padding: 1rem 2rem; gap: 0.8rem; }
    .header-logo-img { width: 46px; height: 46px; }
    .tools-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
    .footer-inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 1.2rem;
        padding: 1.5rem;
    }
    .social-links { flex-wrap: wrap; justify-content: center; }
    .social-btn span { display: none; }
    .social-btn { padding: 0.75rem; border-radius: 50%; }
    .nav-right { gap: 0.5rem; }
    .auth-btn span { display: none; }
    .auth-btn { padding: 0.6rem; border-radius: 50%; }
}

/* ================= Auth (Google Sign-In) ================= */
.auth-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 0.55rem 1.2rem;
    border-radius: 50px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: bold;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.auth-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px var(--accent-glow);
}

/* User menu (logged-in state) + dropdown */
.user-menu {
    position: relative;
}

.user-avatar-btn {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 0.4rem 1rem 0.4rem 0.4rem;
    border-radius: 50px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    color: var(--text-primary);
    font-family: inherit;
    font-weight: bold;
    font-size: 0.9rem;
}

.user-avatar-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 15px var(--accent-glow);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 2px solid var(--accent-color);
    object-fit: cover;
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 0.7rem);
    inset-inline-end: 0;
    min-width: 200px;
    background: var(--bg-dark);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 0.6rem;
    display: none;
    flex-direction: column;
    gap: 0.3rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    backdrop-filter: blur(14px);
    z-index: 30;
}

.user-dropdown.open {
    display: flex;
}

.dropdown-item {
    background: transparent;
    border: none;
    color: var(--text-primary);
    text-align: start;
    padding: 0.7rem 0.9rem;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    transition: background 0.2s ease;
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* Favorites filter + Suggest-a-tool row (next to the view toggles) */
.user-actions {
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

#favoritesFilterBtn.active {
    background: rgba(255, 71, 87, 0.18);
    border-color: rgba(255, 71, 87, 0.4);
    color: #ff6b81;
}

.suggest-action-btn {
    white-space: nowrap;
}

/* Favorite heart button on tool cards */
.favorite-btn {
    position: absolute;
    top: 1rem;
    inset-inline-end: 1rem;
    background: rgba(0,0,0,0.35);
    border: 1px solid var(--glass-border);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 5;
    transition: all 0.25s ease;
    color: var(--text-secondary);
}

.favorite-btn:hover {
    background: rgba(255, 71, 87, 0.2);
    color: #ff6b81;
    transform: scale(1.1);
}

.favorite-btn.active {
    color: #ff4757;
    border-color: rgba(255,71,87,0.5);
}

/* ================= Modals (Suggest a Tool) ================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    display: none;
    justify-content: center;
    align-items: flex-start;
    padding-top: 10vh;
    z-index: 2000;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(10px);
    overflow-y: auto;
}

.glass-modal {
    background: var(--bg-dark);
    border: 1px solid var(--accent-glow);
    border-radius: 24px;
    padding: 2.5rem;
    width: 100%;
    max-width: 550px;
    box-shadow: 0 10px 50px rgba(0,0,0,0.8), inset 0 0 20px rgba(255,255,255,0.03);
    margin: 0 1.5rem 2rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.modal-header h3 {
    font-size: 1.6rem;
    font-weight: 800;
}

.modal-note {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
}

.full-width {
    grid-column: 1 / -1;
}

@media (max-width: 600px) {
    .form-grid { grid-template-columns: 1fr; }
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    transition: color 0.2s;
}

.close-btn:hover { color: #fff; }

.input-group {
    margin-bottom: 1.2rem;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.input-group input, .input-group textarea {
    width: 100%;
    padding: 0.9rem 1.1rem;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

.input-group input:focus, .input-group textarea:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(108, 92, 231, 0.2);
    background: rgba(0, 0, 0, 0.4);
}

.action-btn.primary {
    width: 100%;
    padding: 1rem;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-color), var(--accent-secondary));
    color: #fff;
    border: none;
    font-weight: 700;
    font-size: 1.05rem;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.action-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(108, 92, 231, 0.4);
}

.modal-actions { margin-top: 1.5rem; }

.error-msg {
    color: #ff4757;
    margin-top: 1rem;
    font-size: 0.9rem;
    text-align: center;
    min-height: 20px;
}
