/* ========== Font Import ========== */
@font-face {
    font-family: 'Darumadrop One';
    src: url('../font/Darumadrop_One/DarumadropOne-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* ========== Background Image ========== */
body {
    font-family: 'Darumadrop One', sans-serif;
    overflow-x: hidden; /* Prevent horizontal scroll that might affect background */
    min-height: 100vh; /* Ensure body takes at least full viewport height */
    position: relative; /* Allow for proper positioning of child elements */
}

/* Allow content to extend beyond viewport when needed */
html {
    height: auto; /* Allow scrolling when content exceeds viewport */
}

/* Ensure main content container can extend beyond background */
.page-container {
    min-height: 100vh; /* Start with at least full height */
    position: relative;
    z-index: 1;
}


/* ========== CSS Color Variables ========== */

:root {
    
    /* Metal Colors (für Ihr Edelmetall-Projekt) */
    --gold-color: #ffd700;
    --silver-color: #D9D9D9;
    --platinum-color: #AAA9AD;

    /* Container & border */
    --container-bg: #bf8959;
    --darker-container-bg: #815234;
    --border-color: #26180C;
    
    /* Text Colors */
    --text-primary: #101010;
    --text-secondary: #FFF7E9;
}

/* ========== Centered Introduction Container ========== */
.intro-container {
    /* Perfect centering */
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    
    /* Container styling with your specifications */
    background-color: var(--container-bg);
    opacity: 0.9; /* 90% opacity */
    
    /* Box styling for rectangle shape */
    width: 80vw; /* 80% of viewport width for rectangle shape */
    max-width: 800px; /* Maximum width for very large screens */
    min-width: 600px; /* Minimum width to maintain rectangle */
    padding: 30px 50px; /* More horizontal padding for rectangle */
    height: auto;
    border-radius: 5px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    
    /* Layout */
    text-align: center;
    
    /* Typography */
    color: var(--text-secondary);
}

/* Container content styling */
.intro-container h2 {
    margin-top: 40px;
    margin-bottom: 20px;
    font-size: 2.5em;
    color: var(--text-secondary);
}

.intro-container p {
    line-height: 1.6;
    margin-bottom: 15px;
    font-size: 1.5em;
    color: var(--text-secondary);
}

/* Go Button Container */
.go-button-container {
    display: flex; /* Align icon and button side by side */
    align-items: center; /* Vertically center the items */
    justify-content: center; /* Center the container horizontally */
    margin: 0 auto; /* Center the container horizontally within the intro-container */
    margin-top: 20px; /* Add spacing between the text and the button */
    transition: transform 0.3s ease; /* Smooth hover effect for the entire container */
}

.go-button-container:hover {
    transform: scale(1.1); /* Enlarge the entire container on hover */
}

/* Go Button Styling */
.go-button {
    text-decoration: none;
    background-color: transparent; /* Transparent background */
    color: var(--text-secondary); /* Text color */
    border: none; /* Remove border */
    padding: 10px 20px;
    font-size: 2.5em;
    font-family: "Darumadrop One", sans-serif;
    cursor: pointer;
    text-align: center; /* Center the text inside the button */
}

.go-button:hover {
    color: var(--text-secondary);
    text-shadow: 
        -2px -2px 0 var(--text-primary),
        2px -2px 0 var(--text-primary),
        -2px 2px 0 var(--text-primary),
        2px 2px 0 var(--text-primary);
}

.go-button-icon {
    width: 65px; /* Set the size of the image */
    height: auto;
}

/* ========== Top Left Logo ========== */
.top-logo {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 60px;
    height: auto;
    z-index: 1000;
    cursor: pointer;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.5));
    transition: transform 0.3s ease;
}

.top-logo:hover {
    transform: scale(1.1);
}

/* Torch logo styling - Responsive */
.torch-logo {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 135px;
    height: auto;
    z-index: 1001;
    filter: drop-shadow(2px 2px 4px rgba(0, 0, 0, 0.5));
    transition: transform 0.3s ease;
    max-width: 8vw; /* Responsive to viewport width */
    min-width: 60px; /* Minimum size for usability */
}

.torch-logo:hover {
    transform: scale(1.1);
}

/* Responsive breakpoints for torch logo */
/* --- Responsive Design --- */
@media (max-width: 768px) {
    .torch-logo {
        height: 60px;
        left: 50%;
        transform: translateX(-50%);
    }
    
    .containers-wrapper {
        flex-direction: column;
        align-items: center;
        gap: 30px;
    }
    
    .drop-container {
        width: 90%;
        max-width: 300px;
    }
    
    .main-container {
        width: 100%;
    }
}

@media screen and (max-width: 480px) {
    .torch-logo {
        position: absolute;
        width: 60px;
        top: 10px;
        left: 10px;
        max-width: 15vw;
        min-width: 40px;
    }
}

@media screen and (max-width: 320px) {
    .torch-logo {
        position: absolute;
        width: 50px;
        top: 8px;
        left: 8px;
        max-width: 18vw;
        min-width: 35px;
    }
}

/* Logo link styling */
a[href="index.html"] {
    text-decoration: none;
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
}

/* Help Tooltip */
.help-tooltip {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    font-family: "Darumadrop One", sans-serif;
}

.help-icon {
    width: 60px;
    height: 60px;
    background-color: var(--container-bg);
    border: 3px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    color: var(--text-secondary);
    cursor: pointer;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.help-icon:hover {
    transform: scale(1.1);
    background-color: var(--darker-container-bg);
}

.help-content {
    position: absolute;
    top: 50px;
    right: 0;
    background-color: var(--container-bg);
    border: 3px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    width: 280px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    color: var(--text-secondary);
    font-size: 1.2em;
    line-height: 1.4;
}

.help-tooltip:hover .help-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.help-content h4 {
    margin: 0 0 10px 0;
    font-size: 1.1em;
    color: var(--text-secondary);
    text-align: center;
}

.help-content ul {
    margin: 0;
    padding-left: 15px;
    list-style-type: none;
}

.help-content li {
    margin-bottom: 8px;
    position: relative;
}

.help-content li:before {
    content: "•";
    color: var(--border-color);
    position: absolute;
    left: -15px;
}

/* Global font styling */
h1, p {
    font-family: "Darumadrop One", sans-serif;
}

h1 {
    font-size: 2.2em;
}

p {
    font-size: 1.4em;
}

/* ========== Responsive Design for Rectangle Container ========== */
@media (max-width: 768px) {
    .intro-container {
        width: 90vw; /* Slightly narrower on mobile */
        min-width: 300px; /* Smaller minimum for mobile */
        max-width: 90vw; /* Respect viewport on small screens */
        padding: 20px 30px; /* Less padding on mobile */
    }
}

@media (max-width: 480px) {
    .intro-container {
        width: 95vw; /* Almost full width on very small screens */
        min-width: 280px;
        padding: 15px 20px;
    }
}


/* ================================== index.php ============================================ */

/* Container Layout - Drop Container links, Main Container rechts */
.containers-wrapper {
    display: flex;
    align-items: center; /* Center vertically */
    justify-content: space-between;
    gap: 20px;
    margin: 40px auto 20px auto;
    max-width: 1200px;
    padding: 20px;
    min-height: 60vh; /* Give some height to center properly */
}

.main-container {
    flex: 1; /* Take up remaining space */
    min-width: 0; /* Allow shrinking */
    background-color: var(--container-bg);
    border-radius: 5px;
    padding: 20px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    color: var(--text-color);
}

.chart-container {
    background-color: var(--darker-container-bg) !important;
    padding: 20px;
    border-radius: 5px;
    border: 2px solid var(--border-color);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    margin-top: 20px;
}

.minerals-container {
    background-color: var(--container-bg);
    opacity: 0.95;
    margin: 50px auto 40px 57%; /* Move to the right by setting left margin to 60% */
    padding: 20px;
    border-radius: 5px;
    border: 3px solid var(--border-color);
    max-width: 500px;
    max-height: 120px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    transform: translateX(-50%); /* Center the container on its new position */
}

.minerals-text {
    font-family: "Darumadrop One", sans-serif;
    font-size: 1.5em;
    color: var(--text-secondary);
    margin-bottom: 0px;
    margin-top: 0px;
}

.draggable-item {
    width: 130px;          /* Adjust as you like */
    height: auto;
    border: 3px solid var(--darker-container-bg);
    border-radius: 5px;
    margin: 0px;
    cursor: grab;
    transition: transform 0.2s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.draggable-item:active {
    cursor: grabbing;
    transform: scale(0.95);
}

/* Remove border when item is placed in drop cell */
.drop-cell .draggable-item {
    border: none;
    box-shadow: none;
    margin: 0;
}

.drop-zone {
    display: flex;
    flex-wrap: wrap; /* Allow items to wrap if there are multiple */
    gap: 10px; /* Add spacing between items */
    justify-content: center; /* Center items horizontally */
    align-items: center; /* Center items vertically */
    width: 100%; /* Make it as wide as the container */
    height: 300px; /* Increase the height */
    border: 3px dashed var(--border-color); /* Ensure the border is visible */
    background-color: rgba(255, 255, 255, 0.2); /* Optional: Add a background color */
    border-radius: 20px; /* Keep the rounded corners */
    margin: 20px auto; /* Center it horizontally */
    padding: 20px; /* Add some inner spacing */
}

/* --- Container --- */
.drop-container {
    background-color: var(--container-bg);
    border: 5px solid var(--border-color);
    border-radius: 5px;
    width: 200px;
    padding: 15px;
    box-shadow: 0 6px 10px rgba(0, 0, 0, 0.4);
    text-align: center;
    margin: 0; /* Remove auto margin since flexbox handles positioning */
    align-self: center; /* Center vertically in the flexbox */
}

.drop-title {
    color: var(--text-secondary);
    margin-bottom: 10px;
    font-size: 1.8em;
}

/* --- Grid --- */
.drop-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 4px;
    background-color: var(--container-bg);
    border: 3px solid var(--darker-container-bg);
    padding: 4px;
    width: 160px;
    height: 160px;
    margin: 0 auto 10px auto;
    box-shadow: inset 0 2px 6px rgba(0,0,0,0.4);
}

.drop-cell {
    background-color: #d8c6b0;
    border: 2px solid var(--darker-container-bg);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    min-height: 50px;
    min-width: 50px;
    position: relative;
    cursor: pointer;
}

.drop-cell:hover {
    background-color: #e9d8bf;
}

.drop-cell img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    pointer-events: auto; /* <--- wichtig, damit Klicks funktionieren */
    cursor: pointer;      /* optional: zeigt an, dass es klickbar ist */
}

.drop-cell.over {
    background-color: #e9d8bf;
    border-color: var(--gold-color);
}

.go-button-minerals {
    text-decoration: none;
    background-color: transparent; /* Transparent background */
    color: var(--text-secondary); /* Text color */
    border: none; /* Remove border */
    padding: 10px 20px;
    font-size: 1.8em;
    font-family: "Darumadrop One", sans-serif;
    cursor: pointer;
    text-align: center; /* Center the text inside the button */
    margin-top: 10px;
}

/* --- Items --- */
.items-container {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    gap: 10px;
}

.item {
    padding: 8px 14px;
    border-radius: 5px;
    cursor: grab;
    font-weight: bold;
    color: #fff;
    user-select: none;
}

.item.gold {
    background-color: var(--gold-color);
}
.item.silver {
    background-color: var(--silver-color);
}
.item.platinum {
    background-color: var(--platinum-color);
}

/* ========== Railway Minecart System ========== */

.railway-container {
    position: center;
    width: 100%;
    border-radius: 5px;
    margin-bottom: 20px;
    text-align: center;
}

.railway-track {
    position: relative;
    width: 100%;
    height: 80px;
    margin: 20px 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Schienen */
.rail-line {
    position: absolute;
    width: 90%;
    height: 6px;
    background: linear-gradient(90deg, #4a4a4a 0%, #6a6a6a 50%, #4a4a4a 100%);
    border-radius: 5px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 
        0 2px 4px rgba(0,0,0,0.3),
        inset 0 1px 2px rgba(255,255,255,0.1);
}

/* Checkpoints */
.checkpoint {
    position: absolute;
    top: 70%;
    transform: translateY(-50%);
    cursor: pointer;
    z-index: 10; /* Higher z-index to appear above rail-line */
}

.checkpoint[data-period="1"] { left: 2%; }
.checkpoint[data-period="7"] { left: 45%; }
.checkpoint[data-period="30"] { left: 90%; }

.checkpoint-marker {
    width: 18px;
    height: 18px;
    background: #F5DFB9;
    border: 3px solid var(--border-color);
    border-radius: 50%;
    margin: 0 auto;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
    transition: all 0.3s ease;
    position: relative;
    top: -3px; /* Offset to center perfectly on 6px rail-line */
}

.checkpoint:hover .checkpoint-marker {
    background: var(--border-color);
    transform: scale(1.2);
}

.page-title {
    font-family: "Darumadrop One", sans-serif;
    text-align: center;
    font-size: 2.2em;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.timelabel {
    font-size: 1.8em;
    color: var(--text-secondary);
}

.checkpoint-label {
    font-family: "Darumadrop One", sans-serif;
    font-size: 1.4em;
    color: var(--text-secondary);
    text-shadow: 1px 1px 2px rgba(0,0,0,0.7);
    white-space: nowrap;
    position: relative;
    top: 10px;
    text-align: center;
}

/* Minecart */
.minecart {
    position: absolute;
    top: 50%;
    left: 3%; /* Start position at checkpoint 1 - matches checkpoint exactly */
    transform: translate(-50%, -50%);
    z-index: 15;
    transition: left 0.6s ease-in-out;
    cursor: pointer;
}

.cart-body {
    width: 40px;
    height: 20px;
    background: var(--border-color);
    border: 2px solid (var(--border-color));
    border-radius: 3px;
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}

.cart-body::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    bottom: 2px;
    background: rgb(60, 57, 57);
    border-radius: 2px;
}

.cart-wheels {
    position: relative;
    top: -3px;
}

.wheel {
    width: 8px;
    height: 8px;
    background: var(--text-primary);
    border-radius: 50%;
    position: absolute;
    border: 1px solid var(--border-color);
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.2);
}

.wheel-left { left: 2px; }
.wheel-right { right: 2px; }

/* Active checkpoint styling */
.checkpoint.active .checkpoint-marker {
    background: var(--gold-lighter);
    box-shadow: 0 0 10px var(--gold-color);
    transform: scale(1.3);
}

/* Minecart hover effect */
.minecart:hover {
    transform: translate(-50%, -60%);
}


/* ========== Mineral Info Dropdown Styling ========== */
.mineral-info-container {
    margin: 20px auto; /* Center horizontally */
    padding: 10px;
    background-color: var(--container-bg);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    width: 70%; /* Set a fixed width for centering */
    text-align: left; /* Ensure text inside is aligned to the left */
}

.dropdown-toggle {
    background-color: var(--button-bg);
    color: var(--text-primary);
    padding: 10px 20px;
    font-size: 1.8em;
    border: none;
    cursor: pointer;
    text-align: left; /* Align button text to the left */
    width: 100%; /* Full width button */
    font-family: darumadrop one, sans-serif;
    color: var(--text-secondary);
}

.dropdown-content {
    display: none; /* Hidden by default */
    padding: 15px;
    text-align: left; /* Align text to the left */
    background-color: var(--container-bg);
    border-top: 1px solid var(--border-color);
}


.dropdown-content p {
    font-size: 1.6em;
    color: var(--text-secondary);
    font-family: darumadrop one, sans-serif;
}

/* Show dropdown content when active */
.mineral-info-container.active .dropdown-content {
    display: block;
}

.mineral-info {
    
    display: flex;
    align-items: center;
    margin-bottom: 40px;
}

.mineral-image {
    width: 80px; /* Adjust size as needed */
    height: 50px;
    margin-right: 15px; /* Space between image and text */
    border-radius: 5px; /* Optional: rounded corners */
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2); /* Optional: add a shadow */
}

.mineral-info p {
    font-size: 1.2em;
    color: var(--text-secondary);
    margin: 0;
}


/* ========================================================================== */
/* RESPONSIVE LAYOUT FOR MOBILE VIEW (stack containers vertically) */
/* ========================================================================== */

@media (max-width: 768px) {

  /* Stack all sections vertically */
  .containers-wrapper {
    flex-direction: column;
    align-items: center;
    gap: 30px;
    margin: 20px auto;
  }

  /* Minerals container on top */
  .minerals-container {
    margin: 20px auto 10px auto !important;
    transform: none !important;
    max-width: 90%;
    text-align: center;
  }

  /* Drop container comes next */
  .drop-container {
    order: 2;
    width: 90%;
    max-width: 350px;
  }

  /* Chart container below drop zone */
  .main-container {
    order: 3;
    width: 95%;
    margin-top: 10px;
  }

  .chart-container {
    width: 100%;
    padding: 10px;
  }

  /* Mineral info dropdown last */
  .mineral-info-container {
    order: 4;
    width: 90%;
    margin: 20px auto;
  }

  /* Make draggable items smaller for mobile */
  .draggable-item {
    width: 80px;
    height: auto;
  }

  .drop-grid {
    width: 140px;
    height: 140px;
  }

  .drop-title {
    font-size: 1.5em;
  }

  .go-button-minerals {
    font-size: 1.5em;
  }

  /* Chart title & labels scale down */
  canvas#metalsChart {
    max-width: 100%;
    height: auto;
  }

  /* Help tooltip & torch logo reposition for smaller view */
  .help-tooltip {
    top: 10px;
    right: 10px;
  }

  .torch-logo {
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
  }
}

/* Even smaller phones (≤480 px) */
@media (max-width: 480px) {
  .minerals-container {
    padding: 10px;
  }

  .draggable-item {
    width: 70px;
  }

  .drop-grid {
    width: 120px;
    height: 120px;
  }

  .chart-container {
    padding: 8px;
  }

  .mineral-info-container {
    width: 95%;
  }
}
