/* =========================================
   STEAM CO-OP FINDER - STYLES
   Adapted from user's raspisanie style
   ========================================= */

/* =========================================
   1. VARIABLES & COLOR PALETTE
   ========================================= */
:root {
    --bg-main: #18181b;
    --bg-card: #27272a;
    --bg-card-hover: #3f3f46;
    
    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;
    
    --color-blue: #38bdf8;
    --color-orange: #fbbf24;
    --color-green: #34d399;
    --color-purple: #a78bfa;
    --color-red: #f87171;
    --color-pink: #f472b6;
    
    --accent-ui: #6366f1;
    
    --radius-outer: 16px;
    --radius-inner: 8px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    
    --font-main: 'Montserrat', -apple-system, sans-serif;
}

/* =========================================
   2. GLOBAL STYLES
   ========================================= */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background-color: var(--bg-main);
    color: var(--text-primary);
    margin: 0;
    padding: 15px;
    padding-bottom: 80px;
    background-image: radial-gradient(#3f3f46 1px, transparent 1px);
    background-size: 20px 20px;
    line-height: 1.4;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* =========================================
   3. HEADER
   ========================================= */
header {
    background-color: var(--bg-card);
    padding: var(--spacing-md);
    border-radius: var(--radius-outer);
    box-shadow: 0 4px 0 rgba(0,0,0,0.3); 
    margin-bottom: 20px;
    border: 2px solid #3f3f46;
}

.header-top {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

@media (min-width: 768px) {
    .header-top {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
}

.header-left h1 {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 5px 0;
    letter-spacing: -0.5px;
}

.subtitle {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

#my-profile-link {
    display: inline-block;
    background-color: transparent;
    border: 2px solid var(--color-blue);
    color: var(--color-blue);
    padding: 8px 16px;
    border-radius: var(--radius-inner);
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 600;
    transition: all 0.2s;
}

#my-profile-link:hover {
    background-color: var(--color-blue);
    color: #000;
    transform: translateY(-2px);
}

/* =========================================
   4. CARDS & SECTIONS
   ========================================= */
.card {
    background-color: var(--bg-card);
    border-radius: var(--radius-outer);
    padding: 20px;
    margin-bottom: 20px;
    border: 2px solid #3f3f46;
    box-shadow: 0 4px 0 rgba(0,0,0,0.2);
}

.section-title {
    font-size: 1.3em;
    margin: 0 0 15px 0;
    color: var(--text-primary);
    font-weight: 700;
}

.helper-text {
    color: var(--text-secondary);
    font-size: 0.95em;
    margin-bottom: 20px;
}

/* =========================================
   5. FORM & INPUT
   ========================================= */
.input-group {
    display: flex;
    gap: 10px;
    flex-direction: column;
}

@media (min-width: 768px) {
    .input-group {
        flex-direction: row;
    }
}

#friend-url {
    flex: 1;
    padding: 12px 16px;
    border-radius: var(--radius-inner);
    border: 2px solid #3f3f46;
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1em;
    transition: border-color 0.2s;
}

#friend-url:focus {
    outline: none;
    border-color: var(--accent-ui);
}

#friend-url::placeholder {
    color: var(--text-secondary);
}

button {
    font-family: var(--font-main);
    border: none;
    cursor: pointer;
    transition: transform 0.1s, background-color 0.2s;
    font-weight: 600;
    border-radius: var(--radius-inner);
}

#submit-btn {
    background-color: var(--accent-ui);
    color: #fff;
    padding: 12px 30px;
    font-size: 1em;
    box-shadow: 0 4px 0 #4338ca;
    position: relative;
}

#submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
}

#submit-btn:active:not(:disabled) {
    transform: translateY(2px);
    box-shadow: 0 0 0 #4338ca;
}

#submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.privacy-notice {
    margin-top: 15px;
    padding: 12px;
    background-color: rgba(251, 191, 36, 0.1);
    border-left: 4px solid var(--color-orange);
    border-radius: var(--radius-inner);
    font-size: 0.9em;
    color: var(--text-secondary);
}

.privacy-notice a {
    color: var(--color-orange);
    text-decoration: none;
    font-weight: 600;
}

.privacy-notice a:hover {
    text-decoration: underline;
}

/* =========================================
   6. FILTERS
   ========================================= */
.filter-toggle-btn {
    width: 100%;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9em;
    padding: 12px 0;
    border: none;
    text-align: center;
    transition: color 0.2s;
}

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

#filters {
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    background: var(--bg-main);
    border-radius: var(--radius-inner);
}

#filters:not(.is-closed) {
    padding: 15px;
    border: 1px solid #3f3f46;
    margin-top: 10px;
    max-height: 1000px;
}

#filters.is-closed {
    max-height: 0;
    padding: 0;
    border: none;
}

.filter-group {
    margin-bottom: 15px;
}

.filter-group h3 {
    font-size: 0.85em;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 10px 0;
}

.filter-group label {
    display: block;
    margin: 8px 0;
    cursor: pointer;
    font-size: 0.95em;
    color: var(--text-primary);
    transition: color 0.2s;
}

.filter-group label:hover {
    color: var(--color-blue);
}

.filter-group input[type="checkbox"] {
    accent-color: var(--accent-ui);
    margin-right: 8px;
}

.accent-btn {
    background-color: var(--color-green);
    color: #000;
    padding: 10px 20px;
    font-size: 0.95em;
    margin-top: 10px;
    box-shadow: 0 4px 0 #22c55e;
}

.accent-btn:hover {
    transform: translateY(-2px);
}

.accent-btn:active {
    transform: translateY(2px);
    box-shadow: 0 0 0 #22c55e;
}

/* =========================================
   7. STATISTICS
   ========================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.stat-card {
    background-color: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-inner);
    padding: 15px;
    text-align: center;
    border: 1px solid #3f3f46;
}

.stat-value {
    font-size: 2em;
    font-weight: 800;
    color: var(--color-blue);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.85em;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* =========================================
   8. GAMES LIST
   ========================================= */
#games-list {
    display: grid;
    gap: 15px;
}

.game-card {
    background-color: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-inner);
    overflow: hidden;
    border: 2px solid transparent;
    transition: all 0.3s;
    display: grid;
    grid-template-columns: 200px 1fr;
    grid-template-areas: 
        "image info"
        "image details";
}

@media (max-width: 768px) {
    .game-card {
        grid-template-columns: 1fr;
        grid-template-areas:
            "image"
            "info"
            "details";
    }
}

.game-card:hover {
    border-color: var(--accent-ui);
    background-color: rgba(255, 255, 255, 0.07);
    transform: translateY(-2px);
}

.game-image {
    grid-area: image;
    position: relative;
    overflow: hidden;
}

.game-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.game-info {
    grid-area: info;
    padding: 15px;
}

.game-name {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 10px 0;
}

.game-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.tag {
    font-size: 0.75em;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
}

.tag-coop {
    background-color: rgba(52, 211, 153, 0.15);
    color: var(--color-green);
}

.tag-pvp {
    background-color: rgba(248, 113, 113, 0.15);
    color: var(--color-red);
}

.tag-online {
    background-color: rgba(56, 189, 248, 0.15);
    color: var(--color-blue);
}

.tag-local {
    background-color: rgba(251, 191, 36, 0.15);
    color: var(--color-orange);
}

.tag-remote {
    background-color: rgba(167, 139, 250, 0.15);
    color: var(--color-purple);
}

.tag-controller {
    background-color: rgba(244, 114, 182, 0.15);
    color: var(--color-pink);
}

.game-details {
    grid-area: details;
    padding: 0 15px 15px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.playtime-info {
    display: flex;
    gap: 15px;
    font-size: 0.9em;
}

.playtime-item {
    display: flex;
    flex-direction: column;
}

.playtime-label {
    color: var(--text-secondary);
    font-size: 0.85em;
}

.playtime-value {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.1em;
}

.game-actions {
    display: flex;
    gap: 10px;
}

.game-btn {
    padding: 8px 16px;
    font-size: 0.85em;
    text-decoration: none;
    color: #fff;
}

.btn-steam {
    background-color: #1b2838;
    box-shadow: 0 3px 0 #0f1419;
}

.btn-steam:hover {
    transform: translateY(-2px);
}

.btn-launch {
    background-color: var(--color-green);
    color: #000;
    box-shadow: 0 3px 0 #22c55e;
}

.btn-launch:hover {
    transform: translateY(-2px);
}

/* =========================================
   9. LOADER & ERRORS
   ========================================= */
.is-hidden {
    display: none !important;
}

#loader {
    text-align: center;
    padding: 40px;
}

#loader p {
    margin: 10px 0;
}

.loader-details {
    font-size: 0.9em;
    color: var(--text-secondary);
    margin-top: 15px;
}

.progress-bar {
    width: 100%;
    max-width: 400px;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin: 20px auto;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-ui), var(--color-blue));
    border-radius: 10px;
    transition: width 0.3s ease;
    width: 0%;
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -400px 0;
    }
    100% {
        background-position: 400px 0;
    }
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255,255,255,0.1);
    border-left-color: var(--accent-ui);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px auto;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

.error-message {
    background-color: rgba(248, 113, 113, 0.2);
    color: var(--color-red);
    padding: 20px;
    border-radius: var(--radius-inner);
    text-align: center;
    border: 2px solid var(--color-red);
}

.error-message h3 {
    margin: 0 0 10px 0;
    font-size: 1.5em;
}

.error-message p {
    margin: 0;
}

.btn-loader {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-left-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* =========================================
   10. FOOTER
   ========================================= */
footer {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-top: 40px;
}

footer a {
    color: var(--color-blue);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* =========================================
   11. SCROLL TO TOP BUTTON
   ========================================= */
#scroll-top {
    position: fixed;
    bottom: 25px;
    right: 25px;
}

#scroll-top-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    padding: 0;
    background-color: var(--accent-ui);
    color: #fff;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#scroll-top-btn:hover {
    transform: scale(1.1);
    background-color: #7c3aed;
}

/* =========================================
   12. RANDOM BUTTON
   ========================================= */
#random-btn {
    background-color: var(--color-orange);
    color: #000;
    padding: 8px 16px;
    font-size: 0.9em;
    box-shadow: 0 3px 0 #f59e0b;
}

#random-btn:hover {
    transform: translateY(-2px);
    background-color: #fcd34d;
}

#random-btn:active {
    transform: translateY(2px);
    box-shadow: 0 0 0 #f59e0b;
}

/* =========================================
   13. MOBILE RESPONSIVE
   ========================================= */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .game-card {
        grid-template-columns: 1fr;
    }
    
    .game-image {
        height: 200px;
    }
    
    .playtime-info {
        flex-direction: column;
        gap: 8px;
    }
    
    .header-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .header-actions button,
    .header-actions a {
        width: 100%;
        text-align: center;
    }
}

/* =========================================
   14. EMPTY STATE
   ========================================= */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.5em;
    margin: 0 0 10px 0;
    color: var(--text-primary);
}

.empty-state p {
    margin: 0;
    font-size: 1em;
}
