/* Sea of Tools - Main Stylesheet */
:root {
    /* Light mode variables */
    --primary-color: #b36022;
    --primary-color-rgb: 179, 96, 34;
    --secondary-color: #8a4a1b;
    --text-color: #333333;
    --background-color: rgba(255, 255, 255, 0.75); /* Dimmed background */
    --card-bg-color: rgba(255, 255, 255, 0.9);
    --card-border-color: rgba(179, 96, 34, 0.5);
    --header-footer-bg: rgba(255, 255, 255, 0.85);
    --link-color: #b36022;
    --link-hover-color: #8a4a1b;
    --button-text-color: #fff;
}

/* Dark mode variables */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-color: #e17a2d;
        --primary-color-rgb: 225, 122, 45;
        --secondary-color: #b36022;
        --text-color: #f0f0f0;
        --background-color: rgba(30, 30, 40, 0.75); /* Dimmed background */
        --card-bg-color: rgba(40, 40, 50, 0.9);
        --card-border-color: rgba(225, 122, 45, 0.5);
        --header-footer-bg: rgba(25, 25, 35, 0.9);
        --link-color: #e17a2d;
        --link-hover-color: #ffa959;
        --button-text-color: #fff;
    }
}

/* Theme class overrides for manual switching */
.light-mode {
    --primary-color: #b36022;
    --primary-color-rgb: 179, 96, 34;
    --secondary-color: #8a4a1b;
    --text-color: #333333;
    --background-color: rgba(255, 255, 255, 0.75); /* Dimmed background */
    --card-bg-color: rgba(255, 255, 255, 0.9);
    --card-border-color: rgba(179, 96, 34, 0.5);
    --header-footer-bg: rgba(255, 255, 255, 0.9);
    --link-color: #b36022;
    --link-hover-color: #8a4a1b;
    --button-text-color: #fff;
}

.dark-mode {
    --primary-color: #e17a2d;
    --primary-color-rgb: 225, 122, 45;
    --secondary-color: #b36022;
    --text-color: #f0f0f0;
    --background-color: rgba(30, 30, 40, 0.75); /* Dimmed background */
    --card-bg-color: rgba(40, 40, 50, 0.9);
    --card-border-color: rgba(225, 122, 45, 0.5);
    --header-footer-bg: rgba(25, 25, 35, 0.9);
    --link-color: #e17a2d;
    --link-hover-color: #ffa959;
    --button-text-color: #fff;
}

/* General Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Quicksand', sans-serif;
    color: var(--text-color);
    background-color: #222;
    background-image: url('../img/lightmode.png');
    background-size: cover;
    background-attachment: fixed;
    background-position: center;
    min-height: 100vh;
    transition: background-image 0.5s ease;
}

body.dark-mode {
    background-image: url('../img/darkmode.png');
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
header {
    background-color: var(--header-footer-bg);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 2rem;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.logo-container {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo {
    width: 160px; /* Larger logo size */
    height: auto;
    transition: transform 0.3s;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.25));
}

.logo:hover {
    transform: scale(1.05);
}

.theme-toggle {
    justify-self: start;
}

.empty-space {
    justify-self: end;
}

.theme-toggle button {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.3s;
}

.theme-toggle button:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

body:not(.dark-mode) #moon-icon {
    display: block;
}

body:not(.dark-mode) #sun-icon {
    display: none;
}

body.dark-mode #moon-icon {
    display: none;
}

body.dark-mode #sun-icon {
    display: block;
}

/* Main Content Styles */
main {
    flex: 1;
}

.hero {
    background-color: var(--background-color);
    padding: 3rem 2rem;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 2rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.hero h2 {
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.2rem;
    max-width: 800px;
    margin: 0 auto;
}

.tools {
    background-color: var(--background-color);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.tools h2 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    text-align: center;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

/* Tool Logo Styling */
.tool-logo {
    text-align: center;
    margin-bottom: 1rem;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-logo img {
    max-height: 80px;
    max-width: 100%;
    object-fit: contain;
}

/* Theme-aware logo styling */
.theme-aware-logo {
    transition: filter 0.3s ease;
}

/* Default state for light mode */
body:not(.dark-mode) .theme-aware-logo {
    filter: brightness(0.1); /* Makes logos black in light mode */
}

/* Dark mode state */
body.dark-mode .theme-aware-logo {
    filter: brightness(10); /* Makes logos white in dark mode */
}

/* Specifically targeting only the Forum icon and Steam icon */
body.dark-mode .tool-card:nth-child(6) .tool-logo img, /* SoT Forums */
body.dark-mode .tool-card:nth-child(7) .tool-logo img  /* Steam Discussions */
{
    filter: invert(1) brightness(2);
}

.tool-card {
    background-color: var(--card-bg-color);
    border: 2px solid var(--card-border-color);
    border-radius: 8px;
    padding: 1.5rem;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.tool-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.tool-card h3 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1.4rem;
}

.tool-card p {
    margin-bottom: 1rem;
    line-height: 1.5;
    flex-grow: 1;
}

.tool-link {
    display: inline-block;
    background-color: var(--primary-color);
    color: var(--button-text-color);
    padding: 0.6rem 1.2rem;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.3s;
    align-self: flex-start;
    margin-top: auto;
}

.tool-link:hover {
    background-color: var(--secondary-color);
}

.coming-soon {
    border-style: dashed;
    opacity: 0.8;
}

/* Changelog Page Styles */
.content-section {
    background-color: var(--background-color);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.section-header {
    text-align: center;
    margin-bottom: 2rem;
}

.section-header h2 {
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.changelog {
    max-width: 900px;
    margin: 0 auto;
}

.log-entry {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--card-border-color);
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 1rem;
}

.log-entry:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

/* Responsive Styles */
@media (max-width: 768px) {
    .hero {
        padding: 2rem 1rem;
    }
    
    .tools {
        padding: 1.5rem 1rem;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 1.5rem;
    }
    
    .logo {
        width: 100px;
    }
}

@media (max-width: 480px) {
    header {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        gap: 1rem;
    }
    
    .theme-toggle {
        justify-self: end;
        grid-row: 1;
    }
    
    .logo-container {
        grid-row: 2;
    }
    
    .empty-space {
        display: none;
    }
}

/* Footer Styles */
footer {
    background-color: var(--card-bg-color);
    border: 2px solid var(--card-border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-top: 2rem;
    text-align: center;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.15);
}

.footer-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.footer-links a {
    color: var(--link-color);
    text-decoration: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    transition: all 0.3s;
    font-weight: 500;
}

.footer-links a:hover {
    color: var(--link-hover-color);
    background-color: rgba(var(--primary-color-rgb), 0.1);
    text-decoration: underline;
}

footer p {
    font-size: 0.9rem;
    opacity: 0.8;
    padding-top: 0.5rem;
    border-top: 1px solid var(--card-border-color);
    margin-top: 0.5rem;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: var(--card-bg-color);
    margin: 10vh auto;
    padding: 2rem;
    border: 2px solid var(--card-border-color);
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: modalFadeIn 0.3s;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-content h2 {
    color: var(--primary-color);
    margin-bottom: 0.8rem;
}

.modal-content p {
    margin-bottom: 1.5rem;
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    color: var(--text-color);
    font-size: 1.8rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover {
    color: var(--primary-color);
}

/* Form Styles */
.form-group {
    margin-bottom: 1.2rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.8rem;
    border: 1px solid var(--card-border-color);
    border-radius: 4px;
    background-color: rgba(255, 255, 255, 0.8);
    color: #333;
    font-family: 'Quicksand', sans-serif;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.submit-btn {
    background-color: var(--primary-color);
    color: var(--button-text-color);
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s;
    font-family: 'Quicksand', sans-serif;
}

.submit-btn:hover {
    background-color: var(--secondary-color);
}

.form-message {
    display: none;
    padding: 1rem;
    margin-top: 1rem;
    border-radius: 4px;
    text-align: center;
}

.form-message.success {
    background-color: rgba(76, 175, 80, 0.2);
    border: 1px solid #4caf50;
    color: #2e7d32;
}

.form-message.error {
    background-color: rgba(244, 67, 54, 0.2);
    border: 1px solid #f44336;
    color: #c62828;
}

body.dark-mode .form-group input,
body.dark-mode .form-group textarea {
    background-color: rgba(30, 30, 40, 0.8);
    color: #f0f0f0;
    border-color: rgba(225, 122, 45, 0.3);
}

body.dark-mode .form-message.success {
    color: #81c784;
}

body.dark-mode .form-message.error {
    color: #e57373;
}

/* 404 Error Page Styles */
.error-container {
    background-color: var(--background-color);
    padding: 3rem 2rem;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 2rem;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.error-content {
    max-width: 800px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.error-image {
    margin: 0 auto 2rem;
    position: relative;
    width: 150px;
    height: 150px;
}

.skull {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Pirate skull design */
.skull:before {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 120px;
    background-color: var(--card-bg-color);
    border: 3px solid var(--primary-color);
    border-radius: 60px 60px 40px 40px;
    box-shadow: 0 0 15px rgba(var(--primary-color-rgb), 0.5);
}

.skull:after {
    content: "";
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 40px;
    background-color: var(--card-bg-color);
    border: 3px solid var(--primary-color);
    border-radius: 0 0 30px 30px;
    border-top: none;
}

/* Eyes for skull */
.skull::before,
.skull::after {
    box-shadow: inset 0 0 10px rgba(var(--primary-color-rgb), 0.3);
}

/* Create eyes */
.error-image::before,
.error-image::after {
    content: "✖";
    position: absolute;
    top: 55px;
    font-size: 24px;
    color: var(--primary-color);
    font-weight: bold;
    z-index: 3;
}

.error-image::before {
    left: calc(50% - 25px);
}

.error-image::after {
    right: calc(50% - 25px);
}

/* Create compass rose background */
.error-container::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px;
    height: 500px;
    border: 2px solid rgba(var(--primary-color-rgb), 0.1);
    border-radius: 50%;
    opacity: 0.3;
    z-index: 1;
}

.error-container::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(45deg);
    width: 500px;
    height: 500px;
    border: 2px solid rgba(var(--primary-color-rgb), 0.1);
    border-radius: 50%;
    opacity: 0.3;
    z-index: 1;
}

.error-title {
    font-size: 8rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
    text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.3);
    position: relative;
    animation: floating 3s ease-in-out infinite;
}

@keyframes floating {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

.error-subtitle {
    font-size: 2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
}

.error-message {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.error-actions {
    margin-top: 2rem;
}

.error-button {
    display: inline-block;
    background-color: var(--primary-color);
    color: var(--button-text-color);
    padding: 0.8rem 1.5rem;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s;
    font-size: 1.2rem;
}

.error-button:hover {
    background-color: var(--secondary-color);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.error-tip {
    margin-top: 1.5rem;
    font-style: italic;
    opacity: 0.7;
}

/* Ko-fi button container styling */
.kofi-container {
    justify-self: end;
}

/* Credit text styling */
.credit-text {
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 0.5rem;
}

/* Making the 404 page responsive */
@media (max-width: 768px) {
    .error-title {
        font-size: 6rem;
    }
    
    .error-subtitle {
        font-size: 1.6rem;
    }
}

@media (max-width: 480px) {
    .error-title {
        font-size: 4rem;
    }
    
    .error-subtitle {
        font-size: 1.3rem;
    }
    
    .error-container::before,
    .error-container::after {
        width: 300px;
        height: 300px;
    }
}