/*
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/

@import url("https://fonts.googleapis.com/css?family=Play");

/* --- CSS Variables for Easy Theme Customization --- */
:root {
    --bg-mask-color: #0a0e17; /* Dark Mask */
    --card-bg: rgba(255, 255, 255, 0.03);
    --card-border: rgba(255, 255, 255, 0.05);
    --card-hover-bg: rgba(255, 255, 255, 0.1);
    --card-hover-border: rgba(255, 255, 255, 0.15);
    --card-text-color: #ffffff;
    --toggle-btn-bg: rgba(255, 255, 255, 0.08);
    --toggle-btn-border: rgba(255, 255, 255, 0.15);
    --toggle-btn-color: #ffffff;
    --toggle-btn-hover-bg: rgba(255, 255, 255, 0.18);
    --reveal-bg-url: url("storage/bg/img_bg1.jpg");
}

/* Light Theme Variables */
body.light-theme {
    --bg-mask-color: #f2f4f7; /* Light Mask */
    --card-bg: rgba(255, 255, 255, 0.35);
    --card-border: rgba(0, 0, 0, 0.05);
    --card-hover-bg: rgba(255, 255, 255, 0.6);
    --card-hover-border: rgba(0, 0, 0, 0.1);
    --card-text-color: #1a202c;
    --toggle-btn-bg: rgba(0, 0, 0, 0.05);
    --toggle-btn-border: rgba(0, 0, 0, 0.1);
    --toggle-btn-color: #1a202c;
    --toggle-btn-hover-bg: rgba(0, 0, 0, 0.1);
    /* Keep the starry background image for the reveal effect so it is visible! */
    --reveal-bg-url: url("storage/bg/img_bg1.jpg");
}

/* --- Global styles --- */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-mask-color);
    font-family: "Play", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--card-text-color);
    overflow: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body {
    position: relative;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Canvas Mask & Reveal Background Styles --- */
#tomcatMask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
    pointer-events: none;
    display: block;
}

#tomcatBg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--reveal-bg-url);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: 0;
    pointer-events: none;
    transition: background 0.3s ease;
}

/* On non-hover (touch) devices, hide mask completely so the bg is always visible */
@media (hover: none) {
    #tomcatMask {
        display: none;
    }
}

/* --- Theme Toggle Button --- */
.theme-toggle-btn {
    position: fixed;
    top: 25px;
    right: 25px;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: var(--toggle-btn-bg);
    border: 1px solid var(--toggle-btn-border);
    color: var(--toggle-btn-color);
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transition: all 0.25s ease;
}

.theme-toggle-btn:hover {
    background-color: var(--toggle-btn-hover-bg);
    transform: scale(1.08) rotate(15deg);
}

/* Toggle icon display based on active class */
.sun-icon {
    display: block;
}
.moon-icon {
    display: none;
}

body.light-theme .sun-icon {
    display: none;
}
body.light-theme .moon-icon {
    display: block;
}

/* --- Content Wrapper --- */
#wrapper {
    position: relative;
    display: block;
    width: 100%;
    max-width: 1200px;
    padding: 20px;
    z-index: 2;
}

/* --- Grid of Cards (4 columns x 4 rows) --- */
.grid-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 25px;
    margin: 0 auto;
}

@media (max-width: 1024px) {
    .grid-container {
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .grid-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
}

@media (max-width: 480px) {
    .grid-container {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* The card itself is the <a> link */
.card-item {
    display: flex;
    align-items: center;
    padding: 18px 22px;
    border-radius: 14px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    text-decoration: none;
    transition: background-color 0.25s ease, 
                border-color 0.25s ease;
    cursor: pointer;
}

.card-item:hover {
    background-color: var(--card-hover-bg);
    border-color: var(--card-hover-border);
}

.card-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    object-fit: contain;
    margin-right: 16px;
    background-color: transparent;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--card-text-color);
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
}
