/*
  Theme Name: Trine App
  Theme URI: 
  Author: Your Name
  Description: A custom Material 3 Single Page Application theme powered by AngularJS and UI-Router for the Trine Social Network.
  Version: 1.0.0
  Requires at least: 6.0
  Tested up to: 6.5
  Requires PHP: 7.4
  Text Domain: trine-app
*/

/* style.css */
:root {
  /* Material 3 Light Mode (Default) */
  --md-sys-color-background: #FAFAFA;
  --md-sys-color-surface: #FFFFFF;
  --md-sys-color-surface-variant: #F4F4F4;
  --md-sys-color-surface-container: #F4F4F4;
  --md-sys-color-on-background: #1C1B1F;
  --md-sys-color-primary: #B83280; /* Deep Magenta from logo */
  --md-sys-color-on-primary: #FFFFFF;
  --md-sys-color-secondary: #23A6D5; /* Cyan from logo */
  --md-sys-color-tertiary: #F5A623; /* Golden/Orange for Harmony Scores */
  --md-sys-color-outline: #79747E;

  --pure-material-primary-rgb: 184, 50, 128;     /* Deep Magenta (#B83280) */
  --pure-material-onprimary-rgb: 255, 255, 255;  /* White (#FFFFFF) */
  --pure-material-surface-rgb: 255, 255, 255;    /* Clean White (#FFFFFF) */
  --pure-material-onsurface-rgb: 28, 27, 31;     /* Dark Text (#1C1B1F) */
  
  --app-font-family: 'Product Sans Regular';
}

.dark-theme {
  /* Material 3 Dark Mode */
  --md-sys-color-background: #121212;
  --md-sys-color-surface: #1E1B24; /* Slight violet tint */
  --md-sys-color-surface-variant: #2A2831;
  --md-sys-color-on-background: #E6E1E5;
  --md-sys-color-primary: #D65DB1; 
  --md-sys-color-on-primary: #3E0038;
  --md-sys-color-secondary: #48CAE4;
  --md-sys-color-outline: #938F99;
  --md-sys-color-surface-container: #211F26;

  --pure-material-primary-rgb: 214, 93, 177;     /* Vibrant Magenta (#D65DB1) */
  --pure-material-onprimary-rgb: 62, 0, 56;      /* Dark Violet (#3E0038) */
  --pure-material-surface-rgb: 30, 27, 36;       /* Violet-tinted Surface (#1E1B24) */
  --pure-material-onsurface-rgb: 230, 225, 229;  /* Light Text (#E6E1E5) */
}

body {
  background-color: var(--md-sys-color-background);
  color: var(--md-sys-color-on-background);
  font-family: var(--app-font-family);
  margin: 0;
  padding: 0;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

/* Material 3 Input Styling */
.md-input-container {
  position: relative;
  margin-bottom: 24px;
  width: 100%;
}

.md-input {
  width: 100%;
  padding: 16px;
  background: transparent;
  border: 1px solid var(--md-sys-color-outline);
  border-radius: 4px;
  color: var(--md-sys-color-on-background);
  box-sizing: border-box;
  font-size: 16px;
}

.md-input:focus {
  border-color: var(--md-sys-color-primary);
  outline: none;
  border-width: 2px;
}

/* Material 3 Button Styling */
.md-button-primary {
  background-color: var(--md-sys-color-primary);
  color: var(--md-sys-color-on-primary);
  border: none;
  border-radius: 100px; /* Pill shape */
  padding: 12px 24px;
  font-weight: 600;
  width: 100%;
  font-size: 16px;
  cursor: pointer;
  transition: opacity 0.2s;
  font-family: var(--app-font-family);
}

.md-button-primary:active {
  opacity: 0.8;
}

.pure-material-textfield-outlined > input:-webkit-autofill,
.pure-material-textfield-outlined > input:-webkit-autofill:hover, 
.pure-material-textfield-outlined > input:-webkit-autofill:focus, 
.pure-material-textfield-outlined > input:-webkit-autofill:active {
    /* Use a massive inset box-shadow to override the browser's default autofill background */
    -webkit-box-shadow: 0 0 0 30px rgb(var(--pure-material-surface-rgb, 255, 255, 255)) inset !important;
    
    /* Ensure the text color matches our theme's on-surface color */
    -webkit-text-fill-color: rgba(var(--pure-material-onsurface-rgb, 28, 27, 31), 0.87) !important;
    
    /* Smooth out the transition so it doesn't flash the default yellow/blue */
    transition: background-color 5000s ease-in-out 0s;
}

/* Ensure the floating label stays up when the browser autofills */
.pure-material-textfield-outlined > input:-webkit-autofill + span {
    font-size: 75%;
    line-height: 15px;
}
.pure-material-textfield-outlined > input:-webkit-autofill + span::before,
.pure-material-textfield-outlined > input:-webkit-autofill + span::after {
    border-top-color: transparent !important;
}

/* --- Dialog Styles --- */
.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s;
}
.dialog-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}
.dialog-content {
    background-color: var(--md-sys-color-surface-container);
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 460px;
    box-shadow: 0 4px M8px rgba(0,0,0,0.2);
    transform: scale(0.95);
    transition: transform 0.2s ease;
}
.dialog-overlay.is-visible .dialog-content {
    transform: scale(1);
}
.dialog-header {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
}
.dialog-title {
    margin: 0;
    font-size: 1.25em;
    color: var(--md-sys-color-on-surface);
}
.dialog-body p {
    margin: 0;
    line-height: 1.5;
    color: var(--md-sys-color-on-surface-variant);
}
.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 24px;
}
.action-buttons {
    display: flex;
    gap: 1em;
}
.action-button {
    flex-direction: column;
}

.pure-material-textfield-filled {position: relative;}

.m3-custom-select-trigger {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex!important;
    align-items: center!important;
    padding: 20px 16px 6px 16px; /* Match textfield padding */
    box-sizing: border-box;
    cursor: pointer;
    z-index: 2; /* Place it above the hidden input */
}

.m3-custom-select-value {
    font-size: 1em;
    color: var(--md-sys-color-on-surface);
}

.m3-custom-select-arrow {
    margin-left: auto;
    color: var(--md-sys-color-on-surface-variant);
}

/* --- Dropdown Panel (Same as before) --- */
.m3-select-panel {
    position: absolute;
    top: 100%; /* Position below the textfield */
    left: 0;
    width: 100%;
    background-color: var(--md-sys-color-surface-container);
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    z-index: 100;
    margin-top: 2px;
    overflow: hidden;
}

.m3-option-list {
    list-style: none;
    margin: 0;
    padding: 8px 0;
    max-height: 240px;
    overflow-y: auto;
}

.m3-option {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    color: var(--md-sys-color-on-surface-variant);
    height: 48px;
}

.m3-option:hover {background-color: var(--md-sys-color-surface-container-high);}

.m3-option.selected {
    color: var(--md-sys-color-primary);
    background-color: var(--md-sys-color-surface-container-high);
}

.m3-option-text {flex-grow: 1;}
.m3-select-wrapper {position: relative;}
.m3-select-wrapper.is-active {z-index: 10;}

.natal-form {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.form-row {
    display: flex;
    gap: 16px;
}

.m3-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    background-color: transparent;
    color: var(--primary-color);
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    font-family: var(--app-font-family);
}
.m3-button:hover { background-color: var(--hover-overlay); }
.m3-button.filled {
    background-color: var(--primary-color);
    color: var(--page-background); /* Swaps text color for filled buttons */
    border: none;
}
.m3-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* The outer container holding the manual explorer */
/* The outer container holding the manual explorer */
.manual-explorer-container {
    height: calc(100vh - 250px); 
    overflow-y: auto;
    padding: 16px;
    max-width: 800px;
    margin: 0 auto;
}

.category-block {
    margin-bottom: 32px;
}

.chip-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px; 
}

.sub-chip-container {
    padding-left: 12px;
    margin-top: 12px;
}

/* ---------------------------------------------------
   BASE CHIP STYLING (From Automated Slide)
--------------------------------------------------- */
.interest-chip {
    cursor: pointer;
    border-radius: 100px; 
    font-weight: 500;
    font-size: 15px;
    font-family: var(--app-font-family);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    white-space: nowrap;
    background: none;
    outline: none;
}

/* Icon specific styling */
.chip-icon {
    font-size: 20px;
    margin-right: 8px;
}

/* ---------------------------------------------------
   UNSELECTED STATE
--------------------------------------------------- */
.interest-chip {
    background-color: transparent;
    color: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ---------------------------------------------------
   SELECTED STATE
--------------------------------------------------- */
.interest-chip.selected {
    background-color: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid transparent;
}

/* ---------------------------------------------------
   HIERARCHY ADJUSTMENTS
--------------------------------------------------- */
/* The sub-chips use the exact padding from your automated slide */
.sub-chip {
    padding: 10px 20px;
}

/* The parent chips act as headers, so we tighten the padding and omit the icon */
.parent-chip {
    font-size: 16px;
    font-weight: 600;
    padding: 8px 16px;
}

button.interest-chip.parent-chip.selected {
    background: var(--md-sys-color-primary);
    color: var(--pure-material-onprimary-rgb);
}

/* Subtle divider matching the dark-mode aesthetic */
.category-divider {
    border: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin-top: 24px;
}