/* Styles for the Kanji List Page */

body.kanji-list-page {
    display: flex; /* Use flexbox for overall layout */
    flex-direction: column;
    min-height: 100vh;
    background: var(--gradient); /* Keep the gradient background for the body */
    color: var(--text-dark);
    text-align: center;
    position: relative;
    overflow-x: hidden;
}

body.kanji-list-page main {
    flex-grow: 1; /* Allow main content to grow */
    width: 100%; /* Full width */
    padding: 0; /* Remove padding from main, content div will handle it */
    margin: 0;
}

body.kanji-list-page .header {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px; /* Add padding to header for spacing */
    background: rgba(255, 255, 255, 0.1); /* Transparent background for header */
    backdrop-filter: blur(10px); /* Liquid glass effect for header */
    border-radius: 12px; /* Rounded corners for header */
    margin: 20px auto; /* Center header with some margin */
    max-width: 1200px; /* Constrain header width */
    box-shadow: var(--shadow); /* Subtle shadow */
    position: relative; /* For back-button positioning */
}

body.kanji-list-page .title {
    font-size: 3em;
    margin-bottom: 10px;
    color: white;
}

body.kanji-list-page .title::after {
    background: white;
}

body.kanji-list-page .subtitle {
    font-size: 1.2em;
    color: var(--surface-dim);
}

.back-button {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.2); /* Transparent background */
    backdrop-filter: blur(5px); /* Liquid glass effect */
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3); /* Subtle border */
    padding: 8px 15px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
    box-shadow: var(--shadow); /* Subtle shadow */
}

.back-button:hover {
    background: var(--primary-color);
    color: white;
    transform: translateX(-3px);
    border-color: var(--primary-color); /* Change border on hover */
}

/* Content wrapper for the grid */
.content {
    max-width: 1200px; /* Max width for the content grid */
    margin: 0 auto; /* Center the content grid */
    padding: 20px; /* Padding around the grid */
}

#kanji-list-container, #hiragana-list-container, #katakana-list-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); /* Aim for 5 columns, flexible width */
    gap: 20px;
}

.kanji-item {
    background: rgba(255, 255, 255, 0.15); /* Slightly more opaque for better contrast */
    backdrop-filter: blur(10px); /* Liquid glass effect for cards */
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    box-shadow: var(--shadow); /* Subtle shadow */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.2); /* Subtle border */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 120px;
    position: relative;
}

.kanji-id {
    position: absolute;
    top: 5px;
    left: 5px;
    font-size: 0.65rem;
    font-weight: 800;
    color: white;
    background: var(--primary-color);
    padding: 2px 5px;
    border-radius: 4px;
    line-height: 1;
    z-index: 2;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.kanji-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color); /* Highlight border on hover */
}

.kanji-char {
    font-size: 2.5em;
    font-weight: 700;
    color: white; /* Changed from var(--text-dark) for better contrast */
    margin-bottom: 10px;
    font-family: 'Noto Sans JP', sans-serif;
}

.kanji-meaning {
    font-size: 1em;
    color: white; /* Changed from var(--text-dark) */
    font-weight: 500;
}

.kanji-reading {
    font-size: 0.9em;
    color: var(--surface-dim); /* Soft light gray for secondary info */
    margin-top: 5px;
}

/* Scroll to Top Button */
#scrollToTopBtn {
  display: none;
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: 99;
  border: none;
  outline: none;
  background-color: var(--primary-color);
  color: white;
  cursor: pointer;
  padding: 0;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 24px;
  line-height: 50px;
  text-align: center;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
  transition: opacity 0.3s, background-color 0.3s, transform 0.3s;
}

#scrollToTopBtn:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
}

/* Responsive adjustments for list pages */
@media (max-width: 1200px) {
    .content, body.kanji-list-page .header {
        max-width: 960px; /* Adjust max-width for smaller screens */
    }
}

@media (max-width: 992px) {
    .content, body.kanji-list-page .header {
        max-width: 720px;
    }
    #kanji-list-container, #hiragana-list-container, #katakana-list-container {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); /* Adjust minmax for smaller screens */
    }
}

@media (max-width: 768px) {
    body.kanji-list-page .header {
        margin: 15px auto;
        padding: 15px;
    }
    body.kanji-list-page .title {
        font-size: 2.2em;
    }
    .back-button {
        top: 10px;
        left: 10px;
        padding: 6px 12px;
        font-size: 0.9em;
    }
    .content, body.kanji-list-page .header {
        max-width: 100%; /* Full width on small screens */
        padding: 15px;
    }
    #kanji-list-container, #hiragana-list-container, #katakana-list-container {
        grid-template-columns: repeat(2, 1fr); /* Adjust minmax for smaller screens */
        gap: 15px;
    }
    .kanji-char {
        font-size: 2em;
    }
    .kanji-item {
        min-height: 100px;
    }
    #scrollToTopBtn {
        width: 45px;
        height: 45px;
        font-size: 20px;
        line-height: 45px;
        bottom: 20px;
        right: 20px;
    }
}

@media (max-width: 480px) {
    body.kanji-list-page .header {
        margin: 10px auto;
        padding: 10px;
    }
    body.kanji-list-page .title {
        font-size: 1.6em;
    }
    .content {
        padding: 5px;
    }
    #kanji-list-container, #hiragana-list-container, #katakana-list-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .kanji-char {
        font-size: 1.8em;
        margin-bottom: 8px;
    }
    .kanji-meaning {
        font-size: 0.9em;
    }
    .kanji-reading {
        font-size: 0.8em;
    }
    .kanji-item {
        min-height: 85px;
        padding: 10px;
    }
    #scrollToTopBtn {
        width: 35px;
        height: 35px;
        font-size: 16px;
        line-height: 35px;
        bottom: 10px;
        right: 10px;
    }
}
