:root {
    --background: #181c20;
    --card-bg: #22272e;
    --primary: #ffb400;
    --accent: #ff6600;
    --button-bg: #282e37;
    --button-hover: #ffb400;
    --button-active: #fff;
    --card-radius: 18px;
    --card-shadow: 0 8px 32px rgba(0,0,0,0.18);
    --transition: 0.3s cubic-bezier(.4,2,.6,1);
    --highlight: #ffe066;
    --badge-bg: #23292f;
    --text-color: #f9f9fa;
    --secondary-text: #aaa;
}

body.light {
    --background: #f7f7fa;
    --card-bg: #fff;
    --primary: #005bbd;
    --accent: #0070f3;
    --button-bg: #e6eaff;
    --button-hover: #005bbd;
    --button-active: #fff;
    --card-shadow: 0 8px 32px rgba(0,0,0,0.06);
    --highlight: #ffe066;
    --badge-bg: #eef2fa;
    --text-color: #181c20;
    --secondary-text: #444;
}

body, html {
    background: var(--background);
    color: var(--text-color);
}

.theme-toggle-container {
    display: flex;
    justify-content: flex-end;
    max-width: 1100px;
    margin: 0 auto;
    padding: 18px 14px 0 14px;
    gap: 8px;
}

#theme-toggle, #view-toggle {
background: var(--button-bg);
color: var(--primary);
border: 1px solid #333;
border-radius: 30px;
font-size: 1.09em;
padding: 6px 20px 6px 14px;
cursor: pointer;
outline: none;
display: flex;
align-items: center;
gap: 10px;
transition: background var(--transition), color var(--transition), border-color var(--transition);
}
#theme-toggle:hover, #theme-toggle:focus,
#view-toggle:hover, #view-toggle:focus {
background: var(--button-hover);
color: #fff;
border-color: var(--button-hover);
}

#theme-toggle-icon {
font-size: 1.25em;
}

#theme-toggle-label {
font-size: 1em;
}

#view-toggle i {
font-size: 1.25em;
margin-right: 4px;
}

body, .footer, .text-container, .content-column, .main-header, .controls, .search-bar input {
    transition: background 0.3s, color 0.3s;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 28px 14px 14px 14px;
}

.main-header {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-bottom: 22px;
    justify-content: center;
    flex-wrap: wrap;
}
.logo-header {
    width: 55px;
    height: 55px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
h1 {
    color: var(--primary);
    font-size: 2.2em;
    letter-spacing: 1px;
    margin: 0;
    text-shadow: 0 2px 10px rgba(255, 180, 0, 0.07);
}

/* Search Bar */
.search-bar {
    margin-bottom: 18px;
    display: flex;
    justify-content: center;
}
.search-bar input {
    width: 92%;
    max-width: 380px;
    padding: 12px 18px;
    font-size: 1.08em;
    border: none;
    border-radius: 22px;
    background: #23272e;
    color: #fff;
    transition: box-shadow var(--transition);
    box-shadow: 0 2px 8px rgba(0,0,0,0.09);
    outline: none;
}
body.light .search-bar input {
    background: #eef2fa;
    color: #222;
}

.search-bar input:focus {
    box-shadow: 0 4px 14px var(--primary);
}

/* Controls */
.controls {
    margin: 18px auto 12px auto;
    color: var(--primary);
    font-size: 15px;
    max-width: 750px;
}

.controls-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 10px;
}

.filter-button, .settings-button, .sort-dropdown {
    background: var(--button-bg);
    color: var(--primary);
    border: 1px solid #333;
    border-radius: 28px;
    padding: 9px 20px;
    font-size: 1em;
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    min-width: 90px;
    outline: none;
}

.filter-button.active, .filter-button:focus, .filter-button:hover {
    background: var(--button-hover);
    color: #2a2a2a;
    border-color: var(--button-hover);
    box-shadow: 0 2px 14px rgba(255, 180, 0, 0.13);
}

.settings-button {
    font-size: 1.2em;
    padding: 7px 15px;
}

.sort-dropdown {
    min-width: 120px;
    color: #fff;
    background: #23272e;
    border: 1px solid #444;
    margin-right: 8px;
    margin-bottom: 4px;
}
body.light .sort-dropdown {
    color: #222;
    background: #eef2fa;
}
.sort-dropdown:focus {
    border-color: var(--primary);
}

.hidden {
    display: none !important;
}

/* Text/Stats panel */
.text-container {
    background: #22272e;
    border-radius: 12px;
    padding: 10px 18px 8px 18px;
    margin: 14px 0 6px 0;
    box-shadow: 0 2px 16px rgba(255, 180, 0, 0.04);
}
body.light .text-container {
    background: #fff;
}

.text-container p {
    margin: 4px 0 6px 0;
    color: #f7dba7;
    line-height: 1.45em;
}
body.light .text-container p {
    color: #555;
}

/* Card Grid */
.link-columns.grid-view {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 26px;
    margin-top: 20px;
    margin-bottom: 26px;
}
@media (max-width: 700px) {
    .link-columns.grid-view {
        grid-template-columns: 1fr;
        gap: 14px;
    }
}

/* Card Styles (Grid) */
.link-columns.grid-view .link-item {
    background: var(--card-bg);
    border-radius: var(--card-radius);
    box-shadow: var(--card-shadow);
    padding: 22px 20px 17px 20px;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: transform 0.18s cubic-bezier(.21,1.7,.99,.87), box-shadow 0.17s, background 0.3s, color 0.3s;
    min-width: 0;
    animation: cardIn 0.7s cubic-bezier(.2,2,.6,1) backwards;
}
@keyframes cardIn {
    from { opacity: 0; transform: translateY(42px) scale(0.97);}
    to   { opacity: 1; transform: none; }
}
.link-columns.grid-view .link-item:hover {
    box-shadow: 0 8px 32px 0 rgba(255,180,0,0.09), 0 4px 18px rgba(0,0,0,0.28);
    transform: translateY(-7px) scale(1.021);
    z-index: 2;
}

/* Card Columns */
.badge-column {
    display: flex;
    gap: 5px;
    margin-bottom: 7px;
    flex-wrap: wrap;
    justify-content: flex-start;
}
.content-column {
    flex: 1 1 auto;
    margin-bottom: 7px;
    text-align: left;
}
.link-item a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition);
}
.link-item a:hover {
    text-decoration: underline;
    color: var(--accent);
}
.merchant-name {
    font-size: 1.26em;
    font-weight: 700;
    margin-bottom: 6px;
    word-break: break-word;
}
.min-info {
    font-size: 1em;
    color: #e6e0d5;
    line-height: 1.52;
}
body.light .min-info {
    color: #888;
}
.fav-hide-column {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    align-items: center;
    justify-content: flex-end;
}

/* Card Buttons */
.close-button, .heart {
    background: transparent;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 1.18em;
    padding: 0 8px;
    border-radius: 50%;
    transition: background var(--transition), color var(--transition), box-shadow var(--transition);
    margin: 0 2px;
}
.close-button:hover, .heart:hover {
    color: var(--primary);
    background: #2c2c2c;
    box-shadow: 0 1px 6px 0 rgba(255,180,0,0.13);
}
.heart.favorited {
    color: #e53935;
    background: #1a1a1a;
}

.captcha-badge, .mobileapp-badge, .new-badge, .best-badge, .closed-badge {
    padding: 3.5px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 3px;
    margin-right: 3px;
    text-align: center;
    display: inline-block;
    background: var(--badge-bg);
    box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}
.captcha-badge {
    background: #ff4444;
    color: white;
}
.mobileapp-badge {
    background: #4CAF50;
    color: white;
}
.new-badge {
    background: #ff8c00;
    color: white;
}
.best-badge {
    background: #ff0000;
    color: white;
}
.closed-badge {
    background: #666;
    color: #fff;
    text-decoration: line-through;
}

.highlight {
    background: var(--highlight);
    color: #222;
    border-radius: 4px;
    padding: 1px 2px;
}

.footer {
    margin-top: 36px;
    color: var(--secondary-text);
    font-size: 15px;
    text-align: center;
    letter-spacing: .03em;
    padding-bottom: 12px;
}

/* Accessibility */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* === LIST VIEW STYLES === */
.link-columns.list-view {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 20px;
    margin-bottom: 26px;
}
.link-columns.list-view .link-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: var(--card-shadow);
    padding: 14px 18px;
    margin-bottom: 0;
    min-width: 0;
    gap: 18px;
    animation: cardIn 0.7s cubic-bezier(.2,2,.6,1) backwards;
}
.link-columns.list-view .link-item .list-badges {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 86px;
}
.link-columns.list-view .link-item .list-merchant {
    flex: 1 1 220px;
    font-size: 1.13em;
    font-weight: 700;
    margin-right: 12px;
    word-break: break-word;
}
.link-columns.list-view .link-item .list-mininfo {
    min-width: 200px;
    color: #e6e0d5;
    font-size: 1em;
    display: flex;
    gap: 4px;
    align-items: center;
}
body.light .link-columns.list-view .link-item .list-mininfo {
    color: #888;
}
.link-columns.list-view .link-item .fav-hide-column {
    margin-top: 0;
    min-width: 70px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
}
.link-columns.list-view .link-item .merchant-name {
    font-size: 1.13em;
    font-weight: 700;
    margin-bottom: 0;
}
@media (max-width: 700px) {
    .link-columns.list-view .link-item {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }
    .link-columns.list-view .link-item .list-badges,
    .link-columns.list-view .link-item .list-merchant,
    .link-columns.list-view .link-item .list-mininfo,
    .link-columns.list-view .link-item .fav-hide-column {
        min-width: 0;
    }
    .link-columns.list-view .link-item .list-merchant,
    .link-columns.list-view .link-item .list-mininfo {
        margin-right: 0;
    }
}
