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

body {
    font-family: 'Arial', sans-serif;
    background-color: #000000;
    color: #ffffff;
    line-height: 1.6;
}

/* Header */
header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 50px;
    background-color: #000000;
    position: relative;
    height: 120px;
    width: 100%;
}

.logo {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
}

.logo img {
    width: 120px;
}

nav ul {
    list-style-type: none;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;
}

nav ul li {
    margin: 0 20px;
}

nav ul li a {
    text-decoration: none;
    color: #ffffff;
    font-weight: bold;
    font-size: 1.1rem;
    padding: 10px;
}

nav ul li a:hover {
    color: #28a745;
}

/* Rules Hero Section */
.rules-hero {
    height: 300px;
    background-image: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url('../bilder/bakgrunn-regler.jpg');
    background-size: cover;
    background-position: center;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.rules-overlay {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.rules-hero h1 {
    font-size: 3.5rem;
    color: #ffffff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

/* Intro Section */
.intro-section {
    background-color: #1a1a1a;
    padding: 40px 20px;
    margin-bottom: 40px;
}

.intro-content {
    max-width: 800px;
    margin: 0 auto;
    color: #ffffff;
    line-height: 1.8;
}

.intro-content p {
    margin-bottom: 20px;
    font-size: 1.1rem;
}

/* Rules Container */
.rules-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.rule-section {
    margin-bottom: 60px;
}

.rule-section h2 {
    color: #28a745;
    font-size: 1.8rem;
    margin-bottom: 30px;
    padding-bottom: 10px;
    border-bottom: 2px solid #28a745;
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* Rule Item and Click Effects */
.rule-item {
    position: relative;
}

.rule-title {
    background-color: #1a1a1a;
    padding: 15px 20px;
    border-radius: 8px;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    border: 1px solid #333333;
    position: relative;
    overflow: hidden;
}

.rule-title:hover {
    background-color: #222;
    transform: translateX(5px);
    border-color: #28a745;
}

/* Rule Explanation Styling */
.rule-explanation {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 500px;
    background-color: #1a1a1a;
    padding: 25px;
    border-radius: 12px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid #28a745;
}

.rule-explanation.active {
    opacity: 1;
    visibility: visible;
}

.rule-explanation::before {
    content: '';
    position: absolute;
    left: 50%;
    top: -10px;
    transform: translateX(-50%);
    border-width: 10px;
    border-style: solid;
    border-color: transparent transparent #28a745 transparent;
}

.rule-explanation h3 {
    color: #28a745;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #28a745;
    font-size: 1.2rem;
    padding-right: 40px; /* Make room for close button */
}

.rule-explanation p {
    color: #ffffff;
    line-height: 1.8;
    font-size: 1rem;
    margin-bottom: 15px;
}

.rule-explanation p strong {
    color: #28a745;
    font-weight: 600;
}

.rule-explanation li {
    color: #ffffff;
    margin-bottom: 8px;
    line-height: 1.6;
}

/* Close Button */
.close-button {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #28a745;
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s ease;
    z-index: 1001;
}

.close-button:hover {
    background: #218838;
    transform: scale(1.1);
}

.rule-explanation-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 999;
    backdrop-filter: blur(3px);
}

.rule-explanation-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* Scrollbar styling */
.rule-explanation::-webkit-scrollbar {
    width: 8px;
}

.rule-explanation::-webkit-scrollbar-track {
    background: #1a1a1a;
    border-radius: 4px;
}

.rule-explanation::-webkit-scrollbar-thumb {
    background: #28a745;
    border-radius: 4px;
}

.rule-explanation::-webkit-scrollbar-thumb:hover {
    background: #218838;
}

/* Footer */
footer {
    background-color: #0a0a0a;
    color: #ffffff;
    padding: 60px 0 20px 0;
    margin-top: 60px;
    width: 100vw;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    padding: 0 20px;
    gap: 40px;
    width: 100%;
}

.footer-section {
    flex: 1;
    min-width: 200px;
}

.footer-section h4 {
    color: #28a745;
    font-size: 1.2rem;
    margin-bottom: 20px;
    font-weight: 600;
}

.footer-section p {
    color: #999;
    line-height: 1.6;
    font-size: 0.95rem;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li {
    margin-bottom: 12px;
}

.footer-section ul li a {
    color: #999;
    text-decoration: none;
    transition: color 0.3s ease;
    font-size: 0.95rem;
}

.footer-section ul li a:hover {
    color: #28a745;
}

.social-links {
    display: flex;
    gap: 20px;
}

.social-links a {
    color: #999;
    text-decoration: none;
    transition: color 0.3s ease;
}

.social-links a:hover {
    color: #28a745;
}

.footer-bottom {
    margin-top: 40px;
    padding: 20px 0;
    border-top: 1px solid #222;
    text-align: center;
    background-color: #0a0a0a;
    width: 100vw;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
}

.footer-bottom p {
    color: #666;
    font-size: 0.9rem;
}

/* Media Queries */
@media (max-width: 1200px) {
    .rules-container {
        padding: 0 30px;
    }
    
    .footer-container {
        padding: 0 30px;
    }
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        height: auto;
        padding: 20px;
    }

    .logo {
        position: static;
        transform: none;
        margin-bottom: 20px;
    }

    nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }

    nav ul li {
        margin: 5px 10px;
    }

    .rules-hero h1 {
        font-size: 2.5rem;
    }

    .rules-grid {
        grid-template-columns: 1fr;
    }

    .rule-explanation {
        width: 95%;
        padding: 20px;
        margin: 10px;
        max-height: 90vh;
    }

    .rule-title {
        padding: 12px 16px;
    }

    .rule-title:hover {
        transform: translateX(5px);
    }

    .rule-item {
        margin-bottom: 20px;
    }

    .footer-container {
        flex-direction: column;
        text-align: center;
        gap: 30px;
    }

    .social-links {
        justify-content: center;
    }

    .close-button {
        top: 10px;
        right: 10px;
    }
}

@media (max-width: 480px) {
    .rules-hero h1 {
        font-size: 2rem;
    }

    .intro-content p {
        font-size: 1rem;
    }

    .rule-section h2 {
        font-size: 1.5rem;
    }

    .rule-title {
        padding: 12px 15px;
        font-size: 0.9rem;
    }

    .rule-explanation {
        padding: 15px;
    }

    .rule-explanation h3 {
        font-size: 1rem;
    }

    .rule-explanation p {
        font-size: 0.9rem;
    }

    .close-button {
        width: 25px;
        height: 25px;
        font-size: 16px;
    }
}