/* --------------------------- */
/* Global styles, as original  */
/* --------------------------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Global dark theme settings */
body {
    font-family: Arial, sans-serif;
    background-color: #000;
    color: #fff;
    height: 100vh; /* Keep fullscreen height on large screens */
    overflow: hidden; /* No scrolling on large screens */
}

/* Matrix canvas background */
#matrix {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

/* Main layout (leave room for fixed nav) */
main {
    display: flex;
    justify-content: space-between;
    align-items: stretch;
    gap: 20px;
    padding: 20px;
    height: calc(100vh - 60px);
    overflow: hidden; /* Hide scroll on large screens */
    box-sizing: border-box;
    margin-top: 20px;
}

/* Section styling */
section {
    background: #000;
    border: 1px solid #1f1f1f;
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

    section:hover {
        transform: scale(1.05);
        box-shadow: 0 8px 16px rgba(255, 255, 255, 0.1);
    }

/* RA section */
#RA {
    flex: 1;
    max-width: 10%;
    height: 50%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: #000;
    border: 2px solid #1f1f1f;
    border-radius: 10px;
    padding: 10px;
    font-size: 16px;
    overflow: hidden;
    position: relative;
}

/* Setting container */
.setting-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
    padding-top: 15px;
    margin-bottom: auto;
    font-size: 14px;
}

/* Blurred effect for restricted content */
.blurred {
    opacity: 0.8;
    pointer-events: none;
    transition: all 0.3s ease;
    position: relative;
}

    .blurred::after {
        content: "Please log in or register to access these features";
        position: absolute;
        top: 100%;
        left: 50%;
        width: 80%;
        transform: translate(-50%, -50%);
        font-size: 14px;
        color: #fff;
        background-color: rgba(0, 0, 0, 0.9);
        padding: 10px 15px;
        border-radius: 5px;
        text-align: center;
        z-index: 1;
        pointer-events: none;
    }

.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Login/Register container */
.login-register {
    position: absolute;
    bottom: 10px;
    right: 10px;
    text-align: right;
    font-size: 14px;
}

/* Main section layout */
#main {
    flex: 2;
    max-width: 80%;
    height: 95%;
    overflow-y: auto; /* Let #main scroll if it extends beyond 95% of the container */
    background: #000;
    border: 2px solid #1f1f1f;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Filter container */
.filter-container {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 10px 15px;
    border: 1px solid #2a3748;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

    .filter-container span:hover {
        background: rgba(255, 255, 255, 0.1);
        transform: scale(1.1);
    }

    .filter-container span.active {
        background: rgba(255, 255, 255, 0.2);
        border-radius: 5px;
    }

/* Content container */
.content-container {
    flex: 1;
    border-radius: 10px;
    border: 1px solid #2a3748;
    padding: 15px;
    overflow-y: auto; /* Independent scrolling for the grid area */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px; /* Increased gap */
    justify-items: center;
}

    .content-container::-webkit-scrollbar {
        display: none;
    }

/* Content row */
.content-row {
    padding-top: 35px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 35px;
}

/* Idea box styling */
.content-box {
    background: #1f1f1f;
    padding: 230px;
    text-align: center;
    border-radius: 5px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    font-size: 14px;
    transition: transform 0.3s ease, background-color 0.3s ease;
}

    .content-box:hover {
        background: rgba(255, 255, 255, 0.1);
        transform: scale(1.05);
    }

/* Add section styling */
#add {
    flex: 1;
    max-width: 10%;
    height: 50%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    background: #000;
    border: 2px solid #1f1f1f;
    border-radius: 10px;
    padding: 10px;
    font-size: 14px;
    position: relative;
}

/* Temporarily hide real “Система”/“Крипта” content. Show only “В разработке.” */
.system-container1,
.system-container2 {
    display: none;
}

/* Button styling */
button {
    background-color: #fff;
    color: #000;
    border: none;
    border-radius: 5px;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

    button:hover {
        background-color: #333;
        color: #fff;
        transform: scale(1.1);
    }

/* Exit button styling to match other buttons */
.exit-button {
    background-color: #fff;
    color: #000;
    border: none;
    border-radius: 5px;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s ease, transform 0.3s ease;
    margin-left: 5px;
}

    .exit-button:hover {
        background-color: #333;
        color: #fff;
        transform: scale(1.1);
    }

/* Fixed Navigation Bar */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    /* A slightly opaque dark background for better readability */
    background: rgba(0, 0, 0, 0.7);
    padding: 10px;
    margin: 0;
    display: flex;
    justify-content: center;
    gap: 15px;
    z-index: 100;
}

    .bottom-nav a {
        color: #ffffff;
        text-decoration: none;
        font-weight: bold;
        transition: color 0.3s ease, transform 0.3s ease;
        padding: 8px 10px;
        border-radius: 5px;
    }

        .bottom-nav a:hover {
            text-decoration: none;
            background-color: #333;
            transform: scale(1.05);
        }

/* ---------------- Modal Styling ---------------- */
.modal,
.idea-modal {
    display: none; /* Hidden by default; toggled to flex in JS */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    /* Allow vertical scroll if content is tall: */
    overflow-y: auto;
    background-color: rgba(0, 0, 0, 0.5);
    /* Center the modal content horizontally at least: */
    justify-content: center;
    align-items: flex-start; /* Start from top, can scroll down if big */
    padding: 40px 0; /* Some top/bottom padding */
}

.modal-content,
.idea-modal-content {
    background-color: #1a1a1a;
    padding: 20px;
    border-radius: 10px;
    width: 80%;
    max-width: 800px;
    margin: 0 auto; /* Center horizontally in flex container */
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.7);
    color: #fff;
    position: relative;
    /* Make sure large modal content can scroll internally if needed: */
    max-height: 90vh;
    overflow-y: auto;
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
}

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

.idea-card {
    background: #1f1f1f;
    padding: 30px;
    border-radius: 10px;
    max-width: 600px;
    width: 100%;
    overflow: hidden;
    transition: transform 0.3s ease, background-color 0.3s ease;
    will-change: transform;
    backface-visibility: hidden;
    margin: 20px;
}

    .idea-card:hover {
        transform: scale(1.05);
    }

.media-container img,
.media-container video {
    max-width: 100%;
    max-height: 300px;
    object-fit: cover;
    display: block;
    margin: 0 auto;
}

.idea-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.idea-title {
    font-size: 24px;
    font-weight: bold;
    margin: 0;
}

.idea-author {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

    .idea-author img {
        width: 40px;
        height: 40px;
        border-radius: 50%;
        margin-bottom: 5px;
    }

.idea-body {
    text-align: center;
    margin: 20px 0;
    font-size: 16px;
    line-height: 1.5;
}

.idea-footer {
    display: flex;
    justify-content: flex-start;
    font-size: 14px;
    line-height: 1.4;
}

.idea-modal-content {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    transform: translateZ(0);
}

/* Additional highlight for active filter */
.filter-container span.active {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
}

/* Notifications container */
#notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
}

.notification {
    background-color: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 15px 20px;
    margin-bottom: 10px;
    border-radius: 5px;
    opacity: 0;
    animation: fadeInOut 4s forwards;
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }

    10%, 90% {
        opacity: 1;
        transform: translateY(0);
    }

    100% {
        opacity: 0;
        transform: translateY(-20px);
    }
}

/* -------------------------------------------------------------------
   RESPONSIVE OVERRIDES:
   For phones / tablets (~992px):
   1) Let entire page scroll
   2) Stack sections vertically
   3) Adapt bottom nav
------------------------------------------------------------------- */
@media (max-width: 992px) {
    body {
        height: auto; /* Stop forcing 100vh */
        overflow-y: auto; /* Allow scrolling on small screens */
        overflow-x: hidden;
    }

    main {
        height: auto;
        overflow: visible;
        flex-direction: column;
        align-items: center;
    }

    /* Each section (#RA, #main, #add) goes full width in vertical order */
    #RA,
    #main,
    #add {
        max-width: 100% !important;
        width: 100%;
        margin-bottom: 20px;
        height: auto;
    }

    /* Single-column for ideas in #main */
    .content-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .content-row {
        grid-template-columns: 1fr !important;
    }

    /* The bottom nav is no longer pinned. Instead, place it after the content. */
    .bottom-nav {
        position: static;
        background: #000; /* Make the nav distinct on small screens */
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 10px;
        padding: 15px 0;
    }
        /* Nav links become block-level with some spacing */
        .bottom-nav a {
            display: block;
            width: 100%;
            text-align: center;
            margin: 5px 0;
        }

    /* On small screens, modals fill most of the width */
    .modal-content,
    .idea-modal-content {
        width: 90%;
        max-width: none;
        max-height: 90vh; /* So it doesn't overflow the viewport */
    }
}
