@import url('https://fonts.googleapis.css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-gradient: radial-gradient(circle at top right, #1e1b4b, #0f172a 60%, #020617 100%);
    --card-bg: rgba(255, 255, 255, 0.04);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-hover: rgba(255, 255, 255, 0.08);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.15);
    
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Background Pattern */
body::before {
    content: "";
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: -1;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 40px 40px;
}

/* Header */
header {
    background: rgba(15, 23, 42, 0.7);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #818cf8, #a78bfa, #f472b6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    cursor: pointer;
    transition: filter 0.2s;
}

header h1:hover {
    filter: brightness(1.2);
}

nav a {
    color: var(--text-muted);
    text-decoration: none;
    margin-left: 1.5rem;
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
    padding: 0.5rem 0.8rem;
    border-radius: 6px;
}

nav a:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

/* Main Container */
main {
    flex: 1;
    padding: 3rem 2rem;
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Utilities */
.hidden { display: none !important; }

/* Dashboard / Auth View / Form Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2.5rem;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    margin-bottom: 2rem;
}

.auth-card, .form-card {
    max-width: 440px;
    margin: 4rem auto;
    text-align: center;
}

h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    font-weight: 600;
    letter-spacing: -0.5px;
}

p.subtitle {
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    font-size: 1.1rem;
    line-height: 1.5;
}

/* Forms */
.form-group {
    margin-bottom: 1.8rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.6rem;
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.95rem;
}

input, textarea {
    width: 100%;
    padding: 1rem 1.2rem;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-main);
    font-family: inherit;
    font-size: 1.05rem;
    transition: all 0.2s;
}

input:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem 1.8rem;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

button:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

button:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    box-shadow: none;
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.auth-switch {
    margin-top: 2rem;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.auth-switch a {
    color: var(--primary);
    text-decoration: none;
    cursor: pointer;
    font-weight: 500;
}

.auth-switch a:hover {
    text-decoration: underline;
    color: #818cf8;
}

/* Topic Feed */
.topic-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.topic-header button {
    width: auto;
}

.topic-list {
    display: grid;
    gap: 1.5rem;
}

.topic-item {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.8rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.topic-item::before {
    content: '';
    position: absolute;
    top: 0; left: 0; wifth: 4px; height: 100%;
    background: var(--primary);
    opacity: 0;
    transition: opacity 0.3s;
}

.topic-item:hover {
    transform: translateY(-4px);
    background: var(--card-hover);
    border-color: rgba(99, 102, 241, 0.4);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.topic-item:hover::before {
    opacity: 1;
}

.topic-item h3 {
    font-size: 1.4rem;
    margin-bottom: 0.8rem;
    font-weight: 600;
    color: #fff;
}

.topic-item p {
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.topic-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 500;
}
.topic-meta .t-author {
    color: #a78bfa;
}
.topic-meta .t-stats {
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
}

/* Topic Details */
.topic-detail .card {
    border-top: 4px solid var(--primary);
}

.topic-detail h2 {
    font-size: 2.4rem;
    background: linear-gradient(to right, #ffffff, #c7d2fe);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1.5rem;
}

.topic-detail .description {
    font-size: 1.15rem;
    line-height: 1.7;
    margin-bottom: 2rem;
    color: #e2e8f0;
}

.topic-detail .meta {
    font-size: 0.95rem;
    color: #a78bfa;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Solutions */
.solutions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    margin-top: 3rem;
}

.solutions-header button {
    width: auto;
}

.solution-list {
    display: grid;
    gap: 1.5rem;
}

.solution-item {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    transition: transform 0.2s, background 0.2s;
}

.solution-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.solution-item .sol-desc {
    font-size: 1.1rem;
    line-height: 1.6;
    color: #f1f5f9;
}

.solution-item .sol-meta {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.sol-stats {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 0.5rem;
}

.stat-badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    border: 1px solid transparent;
}

.badge-high {
    background: var(--success-bg);
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.3);
}

.badge-med {
    background: var(--warning-bg);
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.3);
}

.badge-low {
    background: var(--danger-bg);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

.s-votes {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border-color: var(--card-border);
}

/* Voting Slider */
.vote-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--card-border);
    background: rgba(0, 0, 0, 0.15);
    margin: 1.5rem -2rem -2rem -2rem;
    padding: 1.5rem 2rem 2rem 2rem;
    border-radius: 0 0 16px 16px;
}

.vote-section label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 500;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}

input[type=range] {
    flex: 1;
    -webkit-appearance: none;
    background: transparent;
    padding: 0;
    margin: 10px 0;
}

input[type=range]:focus {
    box-shadow: none;
    outline: none;
    background: transparent;
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 6px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

input[type=range]::-webkit-slider-thumb {
    height: 24px;
    width: 24px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    -webkit-appearance: none;
    margin-top: -9px;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.6);
    border: 3px solid #fff;
    transition: transform 0.1s;
}

input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.vote-value {
    font-weight: 700;
    font-size: 1.2rem;
    text-align: right;
    transition: color 0.2s;
}

.vote-btn {
    width: auto;
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
    border-radius: 8px;
}

/* Messages */
.msg {
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    text-align: center;
    font-weight: 500;
    animation: fadeIn 0.3s ease-out;
}

.msg.error {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.msg.success {
    background: rgba(16, 185, 129, 0.15);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    border: 1px dashed var(--card-border);
    font-size: 1.1rem;
}

/* Responsive */
@media (max-width: 600px) {
    header {
        padding: 1rem;
    }
    main {
        padding: 1.5rem 1rem;
    }
    .topic-header, .solutions-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .topic-header button, .solutions-header button {
        width: 100%;
    }
    .slider-container {
        flex-direction: column;
        align-items: stretch;
        gap: 0.8rem;
    }
    .slider-container span {
        display: none;
    }
    .vote-btn {
        width: 100%;
        margin-top: 0.5rem;
    }
    .vote-section {
        margin: 1.5rem -1.5rem -2rem -1.5rem;
        padding: 1.5rem 1.5rem 2rem 1.5rem;
    }
}
