/* --- iOS THEME BASE --- */
:root {
    --bg-color: #000000;
    --card-bg: #1C1C1E;
    --separator: #38383A;
    --text-primary: #FFFFFF;
    --text-secondary: #8E8E93;
    --accent: #F7BCD3;
    --accent-dim: #3a2a30;
    --danger: #FF453A;
    --success: #30D158;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
    color: var(--text-primary);
    padding-bottom: 100px; 
    -webkit-font-smoothing: antialiased; 
}

/* GLOBAL RESET */
* {
    -webkit-tap-highlight-color: transparent;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none; 
    -moz-user-select: none;    
    -ms-user-select: none;     
    -webkit-touch-callout: none; 
}

input, textarea {
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    -webkit-touch-callout: default; 
}

.container {
    max-width: 400px;
    margin: 0 auto;
    padding: 20px 16px; 
}

/* --- TYPOGRAPHY --- */
h1 {
    font-size: 20px;
    margin: 24px 0 10px 0;
    font-weight: 700;
    letter-spacing: 0.3px;
}
h2, h3 {
    margin: 24px 0 10px 0;
    font-weight: 700;
    letter-spacing: 0.3px;
}

h2 { font-size: 28px; }
h3 { 
    font-size: 13px; 
    text-transform: uppercase; 
    color: var(--text-secondary);
    margin-bottom: 8px;
    margin-left: 0; 
}

a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

/* --- TABLES --- */
table {
    width: 100%;
    border-collapse: separate; 
    border-spacing: 0;
    background-color: var(--card-bg);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 24px;
    /* This sets the standard size for ALL columns */
    font-size: 17px; 
}

th {
    background-color: var(--card-bg);
    color: var(--text-secondary);
    font-size: 10px;
    text-transform: uppercase;
    font-weight: 400;
    text-align: left;
    padding: 10px 16px;
    border-bottom: 1px solid var(--separator);
}

th:nth-child(2) {
    text-align: right;
}

td {
    padding: 12px 16px;
    border-bottom: 0.5px solid var(--separator);
    background-color: var(--card-bg);
    color: var(--text-primary);
    vertical-align: middle;
    transition: background-color 0.1s ease;
}

tr:last-child td { border-bottom: none; }

td a { color: var(--text-primary); display: block; font-weight: 400; }

/* GLOBAL 2nd COLUMN (Due Date) */
td:nth-child(2) { 
    color: var(--text-secondary); 
    font-size: 12px;
    text-align: right; 
    white-space: nowrap; 
}
/* --- CUSTOM COLUMN FONT SIZES (FIXED) --- */

/* 1. Task Name (Always the first column) */
td:first-child {
    font-size: 13px !important; /* Change this to resize Task Name */
    font-weight: 500;
}

/* 2. Status Dropdown (Targeting the input directly) */
table td select {
    font-size: 12px !important; /* Change this to resize the text inside the box */
    
    /* CRITICAL: Reduce padding so the box actually looks smaller */
    padding-top: 4px !important;
    padding-bottom: 4px !important;
    height: auto !important; 
}

/* 3. Week View Exception (Keep day names normal) */
.week-table td:first-child {
    font-size: 15px !important; 
    font-weight: 400;
}

/* --- SPECIAL WEEK VIEW TABLE --- */
.week-table {
    table-layout: fixed; 
}

.week-table td:nth-child(2) {
    white-space: normal; 
    line-height: 1.4;
    word-wrap: break-word;
}

/* --- FORMS --- */
form { margin: 0; }

label {
    margin-left: 16px;
    font-size: 13px;
    color: var(--text-secondary);
    text-transform: uppercase;
    display: block;
    margin-top: 15px;
    margin-bottom: 6px;
}

input[type="text"], input[type="password"], input[type="datetime-local"], input[type="date"], textarea, select {
    width: 100%;
    background-color: var(--card-bg);
    color: var(--text-primary);
    border: none;
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 17px;
    font-family: inherit;
    appearance: none;
    -webkit-appearance: none;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    background-color: #2C2C2E;
}

textarea { min-height: 100px; resize: none; }

/* --- BUTTONS --- */
button {
    background-color: var(--accent);
    color: #000;
    font-size: 17px;
    font-weight: 600;
    padding: 14px;
    border-radius: 12px;
    border: none;
    width: 100%;
    cursor: pointer;
    margin-top: 20px;
    transition: opacity 0.2s;
}
button:active { opacity: 0.7; }

td button {
    background: transparent;
    color: var(--danger);
    width: auto;
    padding: 5px;
    margin: 0;
    font-size: 15px;
    text-align: right;
    float: right;
}

td select {
    background-color: transparent;
    color: var(--accent);
    width: auto;
    padding: 5px 0;
    margin: 0;
    font-size: 17px; /* Matched to table text size */
    text-align: right;
    direction: rtl;
    border-radius: 0;
}

/* --- EXTRAS --- */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 5px;
    margin-bottom: 20px;
}
.top-bar a { color: var(--accent); font-size: 17px; }

/* --- FLOATING MESSAGES (TOAST STYLE) --- */
/* --- FLOATING MESSAGES (ALWAYS CENTERED IN VIEWPORT) --- */
/* --- UPDATED iOS TRANSLUCENT MESSAGES --- */
.message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 20000;
    width: 85%;
    max-width: 300px;
    padding: 24px 20px;
    border-radius: 24px; /* Mas rounded gaya ng bagong iOS */
    font-size: 17px;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    
    /* Transparent Blur Effect */
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    display: none; 
    
    /* Default Animation In */
    animation: toastPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* Class para sa Animation Out */
.message.hide {
    animation: toastPopOut 0.4s cubic-bezier(0.6, -0.28, 0.735, 0.045) forwards;
}

/* Translucent Colors (70% opacity para sa transparency) */
.success { 
    background-color: rgba(48, 209, 88, 0.7); 
    color: #FFFFFF; 
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.error { 
    background-color: rgba(255, 69, 58, 0.7); 
    color: #FFFFFF; 
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* --- ANIMATIONS --- */
@keyframes toastPop {
    0% { transform: translate(-50%, -40%) scale(0.85); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

@keyframes toastPopOut {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    100% { transform: translate(-50%, -55%) scale(0.9); opacity: 0; }
}

.today-row td {
    background-color: rgba(247, 188, 211, 0.1);
    font-weight: 600;
}

/* --- REFLECTION PAGE STYLES --- */
.emotion-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr); 
    gap: 10px;
    margin-bottom: 20px;
}

.emotion-label {
    margin: 0 !important; 
    background-color: var(--card-bg);
    padding: 12px;
    border-radius: 12px;
    text-align: left; 
    justify-content: flex-start;
    padding-left: 16px; 
    cursor: pointer;
    border: 1px solid var(--separator);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 13px; 
    transition: 0.2s;
    user-select: none;
    display: flex;
    align-items: center; 
    gap: 8px; 
}

.emotion-label span {
    font-size: 20px; 
    margin-bottom: 0;
    display: inline;
}

input[type="checkbox"]:checked + .emotion-label {
    background-color: var(--accent);
    color: black;
    border-color: var(--accent);
    font-weight: bold;
}
input[type="checkbox"]:disabled + .emotion-label {
    opacity: 0.3;
    cursor: not-allowed;
}
input[type="checkbox"] { display: none; }


/* --- MENU NAVIGATION --- */
.ios-tab-bar {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 400px; 
    height: 60px;
    background-color: rgba(30, 30, 30, 0.9);
    backdrop-filter: blur(12px);
    border-top: 1px solid #333;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 10000; 
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: #8E8E93;
    font-size: 10px;
    width: 100%;
    height: 100%;
    transition: color 0.2s ease;
}

.tab-item .icon { font-size: 24px; margin-bottom: 4px; }
.tab-item.active { color: var(--accent); }
.tab-item:hover { color: var(--accent); }

.menu-icon {
    width: 22px;   
    height: 22px;
    margin-bottom: 4px;
    object-fit: contain;
    filter: invert(1); 
    transition: filter 0.2s ease;
}

.tab-item.active .menu-icon {
    filter: invert(1) drop-shadow(0 0 0.75px white);
}

/* --- BLINK-FREE TRANSITIONS --- */
.transition-slide {
    transition: opacity 0.1s ease-in-out, transform 0.1s ease-out;
    opacity: 1;
    transform: translateY(0);
}

/* State habang naglo-load ang bagong page */
html.is-leaving .transition-slide {
    opacity: 0;
    transform: translateY(10px); /* Swabe na pagbaba */
}

html.is-rendering .transition-slide {
    opacity: 0;
    transform: translateY(-10px); /* Pag-akyat mula sa baba */
}

/* Panatilihing itim ang background para walang "white flash" */
html {
    background-color: #000000;
}

/* --- CHANGELOG LIST --- */
.changelog-item {
    margin-bottom: 15px;
}

.version-tag {
    color: var(--accent); 
    font-weight: bold; 
    font-size: 14px;
    display: block;
    margin-bottom: 4px;
}

.changelog-item ul {
    margin: 0;
    padding-left: 20px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.4;
}

.changelog-item li {
    margin-bottom: 3px;
}

/* --- GLOBAL LOADING SPINNER --- */
#global-loader {
    position: fixed;
    z-index: 9999; 
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5); 
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: none; 
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease-in-out; 
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1); 
    border-top-color: var(--accent); 
    border-radius: 50%;
    animation: spin 0.8s linear infinite; 
    will-change: transform; 
    transform: translateZ(0); 
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#global-loader.visible {
    display: flex;
    opacity: 1;
}

/* --- CLICKABLE TABLE ROWS --- */
.task-row {
    cursor: pointer;
}

.task-row:hover td {
    background-color: #2C2C2E !important; 
}

.task-row:active td {
    background-color: #2C2C2E !important; 
}

.task-row a {
    text-decoration: none;
    color: inherit;
    display: block;
    height: 100%;
}

/* --- UTILITIES --- */
.profile-card {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    margin-bottom: 24px;
}

.profile-img {
    width: 50px; 
    height: 50px; 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    margin-right: 15px; 
    filter: invert(1) brightness(100%);
}

.app-info-card {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 24px;
}

.security-badge {
    margin-top: 15px;
    background-color: rgba(48, 209, 88, 0.1);
    padding: 10px;
    border-radius: 8px;
    display: flex;
    align-items: start;
    gap: 8px;
}

/* --- FINAL iOS REFLECTION CARD --- */
.reflection-card {
    background-color: var(--card-bg);
    padding: 18px;
    border-radius: 16px;
    margin-bottom: 16px;
    position: relative; /* Anchor para sa delete button */
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.reflection-header {
    /* Tinanggal ang flex-between dito para hindi mag-wrap ang button */
    margin-bottom: 10px;
    padding-right: 40px; /* Space para hindi matakpan ng delete button */
}

.reflection-date {
    color: var(--text-secondary);
    font-size: 13px;
    display: block;
    margin-top: 2px;
}

.reflection-note {
    margin: 0;
    line-height: 1.5;
    color: var(--text-primary);
    font-size: 15px;
    word-wrap: break-word; /* Pinipigilan ang pag-overflow ng mahabang salita */
    overflow-wrap: break-word;
}

/* Delete Button Corner - Absolute Position */
.delete-x {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(255, 255, 255, 0.05); /* Subtle circle background */
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 22px;
    border: none;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    transition: all 0.2s ease;
}

.delete-x:active {
    background-color: rgba(255, 69, 58, 0.2);
    color: var(--danger);
    transform: scale(0.9);
}