/* file name: styles.css */

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* General Styles */
body {
    font-family: Arial, sans-serif;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #f4f4f4; /* Optional: light background for body */
}

.dashboard {
    display: grid;
    grid-template-rows: auto 1fr auto;
    grid-template-areas:
        "header"
        "main"
        "footer";
    height: 100%;
}

.header {
    grid-area: header;
    background-color: #333;
    color: white;
    padding: 1em;
    display: flex;
   justify-content: space-between;
    gap: 1em;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.logo {
    font-size: 1.5em;
    font-weight: bold;
}

.nav {
    display: flex;
    gap: 0.5em;
    padding-right: 3em;
}

.nav .nav-item {
    background: #555;
    color: white;
    border: none;
    padding: 0.5em 1em;
    border-radius: 5px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5em; /* adds spacing between icon and text */
    transition: background-color 0.2s ease;
}
.nav .nav-item:hover {
    background: #666;
}


.menu-toggle {
    display: none; /* Not used currently */
    background: #555;
    color: white;
    border: none;
    font-size: 1.2em;
    padding: 0.5em 1em;
    cursor: pointer;
}

/* Mobile Menu Styles (Placeholder - Not implemented in provided HTML) */
.mobile-menu {
    display: none;
    position: absolute;
    top: 60px;
    left: 0;
    width: 100%;
    background: #f4f4f4;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}
/* ... other mobile menu styles if needed ... */


/* Main Content Styles */
.main-content {
    grid-area: main;
    padding: 2em;
    background: #fff; /* White background for main content area */
    overflow-y: auto;
}

/* Tool Cards Grid */
.tool-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); /* Responsive columns */
    gap: 1.5em; /* Slightly more gap */
    justify-content: center;
    align-items: start;
}

.tool-card {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 1.5em 1em; /* More padding */
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative; /* Needed for badge/emoji positioning */
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.tool-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}

.tool-card img {
    max-width: 50%; /* Slightly larger icons */
    height: auto;
    margin-bottom: 1em;
}

.clock-emoji {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 1.4em;
  z-index: 10;
  opacity: 0.8;
}

.badge { /* Base badge style */
  position: absolute;
  top: 10px;
  left: 10px; /* Moved badges to the left */
  color: white;
  padding: 0.3em 0.6em;
  font-size: 0.75em;
  font-weight: bold;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
  z-index: 10;
}

.badge.free {
  background-color: #28a745; /* green */
}

.badge.coming-soon {
  background-color: #ffc107; /* soft yellow */
  color: black;
}

/* Footer Styles */
.footer {
    grid-area: footer;
    background: #333;
    color: white;
    text-align: center;
    padding: 1em;
    /* position: relative; */ /* Generally not needed for grid layout */
    /* bottom: 0; */
}

/* Toast Message Styles (Placeholder - Not active) */
.toast {
    position: fixed;
    bottom: 20px;
    right: 50px;
    background: rgba(50, 50, 50, 0.95); /* Darker toast */
    color: #fff;
    padding: 1em 1.5em;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    font-size: 1em;
    z-index: 1100; /* High z-index */
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    max-width: 300px;
    line-height: 1.5;
    text-align: left;
    word-wrap: break-word;
}
.toast.visible {
    opacity: 1;
    transform: translateY(0);
}


/* Matilda Face Icon */
.matilda-icon {
  position: fixed;
  bottom: 47px; /* Adjusted position */
  right: 25px;
  z-index: 990; /* Below modal overlay */
}
.matilda-icon img {
  width: 60px;
  height: auto;
  border-radius: 50%;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.25);
  border: 2px solid #333333; /* Optional border */
}

/* Matilda Message Teaser Bubble */
#matilda-note {
  position: fixed;
  bottom: 120px; /* Adjusted position */
  right: 30px; /* Adjusted position */
  background-color: #333;
  color: white;
  padding: 0.75em 1em;
  border-radius: 8px;
  font-size: 0.9em;
  z-index: 991; /* Below modal overlay, above icon */
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  animation: obvious-glow 1.5s infinite ease-in-out;
}
#matilda-note::after { /* Speech bubble pointer */
  content: "";
  position: absolute;
  bottom: -9px; /* Adjusted */
  right: 15px; /* Adjusted */
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid #333;
}
/* Obvious Blue Glow animation */
@keyframes obvious-glow {
  0%, 100% {
    box-shadow:
      0 2px 8px rgba(0, 0, 0, 0.2),
      0 0 6px rgba(0, 191, 255, 0.3);
  }
  50% {
    box-shadow:
      0 2px 12px rgba(0, 0, 0, 0.25),
      0 0 25px rgba(0, 255, 255, 0.85),
      0 0 15px rgba(173, 216, 230, 0.6);
  }
}

/* --- Matilda Interaction Modal Styles --- */
.matilda-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.75); /* Dark overlay */
  z-index: 1010; /* High z-index */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1em; /* Padding for smaller screens */
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}
.matilda-modal-overlay.visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease;
}

.matilda-modal-content {
  background-color: #282c34; /* Slightly lighter dark bg */
  color: #e0e0e0; /* Off-white text */
  padding: 1.5em; /* Base padding */
  border-radius: 12px;
  max-width: 550px;
  width: 100%; /* Let max-width control size */
  box-shadow: 0 8px 25px rgba(0,0,0,0.5);
  position: relative; /* CRITICAL for absolute positioning inside */
  transform: scale(0.95); /* Start slightly smaller */
  transition: transform 0.3s ease;
  text-align: center; /* Default alignment for content */
}
.matilda-modal-overlay.visible .matilda-modal-content {
   transform: scale(1); /* Scale to full size */
}

/* Initial Prompt Specific Styles */
#modal-initial-view p {
    line-height: 1.5;
}
#modal-initial-view .modal-buttons {
    margin-top: 2em; /* More space before buttons */
}

/* Message View Specific Styles */
#modal-message-view {
    padding-top: 3em; /* Space for the absolutely positioned controls */
}

/* Controls Container (Mute/Close) */
.modal-controls-top-right {
  position: absolute; /* Position relative to matilda-modal-content */
  top: 1em; /* Distance from top */
  right: 1em; /* Distance from right */
  display: flex;
  gap: 0.75em; /* Space between buttons */
  z-index: 1011; /* Ensure they are above message text */
}

/* Style the buttons within the top-right controls */
.modal-controls-top-right .modal-button {
  padding: 0.5em 1em; /* Slightly smaller padding */
  font-size: 0.9em; /* Slightly smaller font */
  background-color: #444; /* Darker gray */
}
.modal-controls-top-right .modal-button:hover {
  background-color: #555;
}
.modal-controls-top-right .modal-button.close {
  background-color: #782a34; /* Muted red for close */
}
.modal-controls-top-right .modal-button.close:hover {
  background-color: #8a3c47;
}
.modal-controls-top-right .modal-button.audio-toggle {
  background-color: #3a5f7e; /* Muted blue for audio toggle */
}
.modal-controls-top-right .modal-button.audio-toggle:hover {
  background-color: #4b769a;
}


/* Message Text Area */
#modal-message-text {
  text-align: left; /* Keep message text left-aligned */
  line-height: 1.6;
  max-height: 60vh; /* Limit height and allow scroll if needed */
  overflow-y: auto; /* Add scrollbar if content overflows */
  padding-right: 0.5em; /* Space for scrollbar */
}
#modal-message-text p {
  margin-bottom: 1em;
}
#modal-message-text p:last-child {
  margin-bottom: 0;
}
#modal-message-text .emoji-bullet {
   color: #28a745;
   margin-right: 0.5em;
   display: inline-block; /* Ensure proper spacing */
}
#modal-message-text em {
    font-style: normal;
    color: #a0d8ff;
    font-weight: normal; /* Less bold */
}
#modal-message-text strong {
    color: #ffd700;
    font-weight: 600; /* Slightly less heavy */
}


/* General Modal Button Styles */
.modal-buttons { /* Container for button groups */
  display: flex;
  justify-content: center;
  gap: 1em;
  margin-top: 1.5em; /* Default spacing */
  flex-wrap: wrap; /* Allow buttons to wrap on small screens */
}
.modal-button { /* Individual button base style */
  padding: 0.7em 1.5em;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95em;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  justify-content: center; /* Center icon/text */
  gap: 0.6em;
  transition: background-color 0.2s ease, transform 0.1s ease;
  color: white; /* Default text color */
  text-align: center;
}
.modal-button:active {
    transform: scale(0.97);
}
.modal-button i { /* Make icons slightly smaller */
    font-size: 0.9em;
    line-height: 1; /* Prevent extra space */
}

/* Specific Button Colors (Initial Prompt) */
.modal-button.play {
  background-color: #28a745;
}
.modal-button.play:hover {
  background-color: #218838;
}
.modal-button.read {
  background-color: #007bff;
}
.modal-button.read:hover {
  background-color: #0056b3;
}

/* Don't Show Checkbox Area */
.modal-dont-show {
    text-align: center;
    margin-top: 2.5em; /* More space */
    font-size: 0.9em;
    opacity: 0.8;
}
.modal-dont-show label {
    cursor: pointer;
    margin-left: 0.5em;
}
.modal-dont-show input[type="checkbox"] {
    cursor: pointer;
    vertical-align: middle;
    margin-right: 0.2em; /* Space before label */
}

/* Utility class to hide elements */
.hidden {
  display: none !important;
}


/* Responsive Adjustments */
@media (max-width: 768px) {
    .nav { padding-right: 1em; }
    .tool-cards { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}

@media (max-width: 480px) {
    .header { padding: 0.5em 1em; gap: 0.5em; }
    .logo { font-size: 1.2em; }
    .nav .nav-item { padding: 0.4em 0.8em; font-size: 0.9em; }
    .main-content { padding: 1em; }
    .tool-cards { grid-template-columns: 1fr; gap: 1em;} /* Single column */

    /* Adjust Matilda elements for small screens */
    .matilda-icon { bottom: 15px; right: 15px; }
    .matilda-icon img { width: 50px; }
    #matilda-note { bottom: 75px; right: 40px; font-size: 0.85em; padding: 0.6em 0.9em; }
    #matilda-note::after { right: 10px; bottom: -8px; border-top-width: 8px; }

    /* Modal adjustments for small screens */
    .matilda-modal-content { padding: 1em 1.5em; }
    .modal-controls-top-right { top: 0.5em; right: 0.5em; gap: 0.5em; }
    .modal-controls-top-right .modal-button { padding: 0.4em 0.8em; font-size: 0.8em; }
    #modal-message-view { padding-top: 2.5em; } /* Less padding needed */
    .modal-button { padding: 0.6em 1.2em; font-size: 0.9em; } /* Slightly smaller main buttons */
}