/* css/style.css */

/* --- CSS VARIABLES --- */
:root {
    --bg-color: #000000;
    --bg-gradient: radial-gradient(circle at center, #1a1a1a 0%, #000000 70%);
    
    /* Solid colors for cards */
    --card-bg: #111111; 
    --card-hover: #1a1a1a;
    --input-bg: #222222; /* New var for inputs/widgets to stand out */
    
    --text-main: #ffffff;
    --text-sub: #cccccc;
    --text-body: #bbbbbb;
    --text-muted: #666666;
    --border-color: rgba(255, 255, 255, 0.2);
    --btn-hover-bg: #ffffff;
    --btn-hover-text: #000000;
    --shadow-color: rgba(255, 255, 255, 0.2);
    --icon-color: #ffffff;
    --accent-green: #4caf50;
    --accent-red: #d32f2f;
    --grain-opacity: 0.05;
}

body.light-mode {
    --bg-color: #ffffff;
    --bg-gradient: radial-gradient(circle at center, #f0f0f0 0%, #ffffff 70%);
    
    /* Solid colors for Light Mode */
    --card-bg: #ffffff;
    --card-hover: #f5f5f5;
    --input-bg: #eeeeee;
    
    --text-main: #000000;
    --text-sub: #333333;
    --text-body: #555555;
    --text-muted: #555555;
    --border-color: rgba(0, 0, 0, 0.2);
    --btn-hover-bg: #000000;
    --btn-hover-text: #ffffff;
    --shadow-color: rgba(0, 0, 0, 0.2);
    --icon-color: #000000;
    --grain-opacity: 0.03;
}

/* --- RESET & BASICS --- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { 
    width: 100%; 
    overflow-x: hidden;
    min-height: 100vh;
}

body {
    background-color: var(--bg-color);
    background-image: var(--bg-gradient);
    
    color: var(--text-main);
    font-family: 'Montserrat', sans-serif;
    font-weight: 300;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px;
    overflow-x: hidden;
    transition: color 0.5s ease, background 0.5s ease;
}

/* --- FILM GRAIN OVERLAY --- */
body::before {
    content: "";
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; 
    z-index: 0; 
    opacity: var(--grain-opacity);
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* --- CONTROLS --- */
.controls-group {
    position: absolute; top: 30px; right: 30px;
    display: flex; align-items: center; gap: 20px; 
    z-index: 100;
}
.icon-btn {
    background: none; border: none; padding: 5px;
    display: flex; align-items: center; justify-content: center;
    color: var(--icon-color); transition: transform 0.3s ease;
    text-decoration: none; cursor: pointer;
}
.icon-btn svg { width: 22px; height: 22px; fill: var(--icon-color); }
.icon-btn:hover svg { transform: scale(1.1); }
.theme-toggle:hover svg { transform: rotate(15deg) scale(1.1); }

/* --- LANDING PAGE --- */
.container { text-align: center; width: 100%; max-width: 900px; padding: 20px; position: relative; z-index: 10; }

.signature-font {
    font-family: 'Cinzel', serif; font-weight: 400; font-size: 5rem; line-height: 1.2;
    padding: 10px 0; letter-spacing: 2px; color: transparent;
    background: linear-gradient(to right, var(--text-main) 20%, #888 50%, var(--text-main) 80%);
    background-size: 200% auto; -webkit-background-clip: text; background-clip: text;
    animation: shine 5s linear infinite;
}
body.light-mode .signature-font {
    background: linear-gradient(to right, #000 20%, #666 50%, #000 80%);
    background-size: 200% auto; -webkit-background-clip: text; background-clip: text;
}
.job-title { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 5px; color: var(--text-sub); margin-top: 10px; margin-bottom: 50px; font-weight: 400; }
.bio-text { font-size: 1.05rem; max-width: 680px; color: var(--text-body); margin: 0 auto 50px auto; line-height: 1.9; }
.credentials { font-size: 0.65rem; letter-spacing: 3px; color: var(--text-body); text-transform: uppercase; margin-top: 40px; opacity: 0.7; }
.actions-wrapper { display: flex; flex-direction: column; align-items: center; gap: 30px; margin-bottom: 60px; }

.btn {
    text-decoration: none; color: var(--text-main);
    border: 1px solid var(--border-color); padding: 16px 50px;
    font-size: 0.75rem; text-transform: uppercase; letter-spacing: 3px;
    transition: all 0.4s ease; 
    background-color: var(--bg-color); 
    display: inline-block; cursor: pointer;
}

.social-row { display: flex; gap: 30px; }

.social-link {
    color: var(--text-main); opacity: 0.8; transition: all 0.3s ease;
    display: flex; align-items: center; justify-content: center;
    padding: 10px; border-radius: 50%;
    background-color: transparent;
}
.social-link svg { width: 24px; height: 24px; fill: currentColor; }
.btn:hover, .social-link:hover {
    background-color: var(--btn-hover-bg); color: var(--btn-hover-text);
    border-color: var(--btn-hover-bg); box-shadow: 0px 0px 15px var(--shadow-color);
    transform: translateY(-3px);
}
.social-link:hover { background-color: transparent; color: var(--text-main); filter: drop-shadow(0px 0px 8px var(--shadow-color)); }

/* --- LOGIN GATE --- */
#login-gate {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: #000000; z-index: 9999;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    transition: opacity 0.5s ease;
}
.login-box { display: flex; flex-direction: column; align-items: center; text-align: center; }
.login-header { font-family: 'Space Mono', monospace; font-size: 2.5rem; margin-bottom: 20px; text-transform: uppercase; letter-spacing: -1px; color: #fff; }
.pin-input {
    background: transparent; border: none; border-bottom: 1px solid #666;
    color: #fff; font-family: 'Montserrat', sans-serif; font-size: 2rem;
    text-align: center; letter-spacing: 10px; width: 250px; outline: none; margin-top: 20px;
    transition: border-color 0.3s;
}
.pin-input:focus { border-bottom-color: #fff; }
.error-msg { color: var(--accent-red); font-size: 0.8rem; margin-top: 15px; opacity: 0; transition: opacity 0.3s; font-family: 'Montserrat', sans-serif; }
.auth-input { width: 80%; max-width: 300px; font-size: 1.2rem; letter-spacing: 2px; margin-bottom: 15px; text-align: center; }

/* --- DASHBOARD / GENERAL LAYOUT --- */
.dashboard-container {
    width: 100%; max-width: 900px; position: relative; z-index: 10;
    display: none; flex-direction: column; gap: 20px;
    animation: fadeIn 1s ease forwards; padding-bottom: 40px;
}
.header-section { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 5px; padding: 0 5px; }
.header-greeting {
    font-family: 'Space Mono', monospace; font-size: 2rem;
    text-transform: uppercase; letter-spacing: -1px; line-height: 1;
    background: linear-gradient(to right, var(--text-main) 20%, #888 50%, var(--text-main) 80%);
    background-size: 200% auto; -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: shine 10s linear infinite;
}
body.light-mode .header-greeting { background: linear-gradient(to right, #000 20%, #666 50%, #000 80%); background-size: 200% auto; -webkit-background-clip: text; background-clip: text; }
.date-display { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 2px; color: var(--text-muted); }

/* --- CARDS (TILES) --- */
.card {
    background: var(--card-bg); 
    border: 1px solid var(--border-color); 
    border-radius: 18px;
    padding: 20px; 
    transition: all 0.3s ease; 
    display: flex; 
    flex-direction: column;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.card:hover {
    background: var(--card-hover); 
    transform: translateY(-2px);
    border-color: rgba(125,125,125,0.4); 
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.card-title { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 2px; color: var(--text-muted); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.split-section { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; width: 100%; }

/* --- CLOCKS --- */
.clocks-card { flex-direction: row; justify-content: space-between; align-items: center; padding: 25px; }
.clock-item { text-align: center; flex: 1; border-right: 1px solid var(--border-color); }
.clock-item:last-child { border-right: none; }
.clock-time { font-size: 1.5rem; font-weight: 300; color: var(--text-main); margin-bottom: 5px; }
.clock-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 2px; color: var(--text-muted); }

/* --- APP TILES --- */
.app-grid { display: grid; grid-template-columns: repeat(auto-fit, 85px); justify-content: flex-start; gap: 20px; margin-top: 15px; }
.app-tile {
    width: 85px; height: 85px; 
    background: linear-gradient(145deg, var(--card-bg), var(--card-hover));
    border: 1px solid var(--border-color); border-radius: 18px;
    display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
    padding-top: 20px; text-decoration: none; transition: all 0.3s ease; box-sizing: border-box;
}
.app-tile svg { width: 26px; height: 26px; fill: var(--text-main); margin-bottom: 8px; flex-shrink: 0; }
.app-label { font-size: 0.5rem; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-sub); text-align: center; line-height: 1.2; width: 100%; padding: 0 4px; }
.app-tile:hover { background: var(--text-main); transform: translateY(-3px); box-shadow: 0 5px 15px rgba(0,0,0,0.2); }
.app-tile:hover svg { fill: var(--bg-color); }
.app-tile:hover .app-label { color: var(--bg-color); }

/* --- CALENDAR --- */
.calendar-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; padding: 0 5px; }
.cal-nav-btn {
    background: none; border: 1px solid var(--border-color); color: var(--text-main);
    width: 26px; height: 26px; border-radius: 50%; cursor: pointer;
    display: flex; align-items: center; justify-content: center; transition: 0.2s; font-size: 0.7rem;
}
.cal-nav-btn:hover { background: var(--text-main); color: var(--bg-color); }
.cal-controls { display: flex; gap: 8px; align-items: center; }
select.cal-select {
    background: transparent; color: var(--text-main); border: none; padding: 2px;
    font-family: inherit; font-size: 0.75rem; cursor: pointer; outline: none;
    text-transform: uppercase; letter-spacing: 1px; font-weight: 500;
}
select.cal-select option { background: #000; color: #fff; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 5px; min-height: 250px; }
.cal-day {
    aspect-ratio: 1 / 1; display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; background: var(--card-bg); 
    border: 1px solid var(--border-color); cursor: pointer; border-radius: 10px;
    transition: 0.2s; color: var(--text-sub);
}
.cal-day:not(.cal-header):not(.cal-empty):hover {
    background: var(--text-main); border-color: var(--text-main); color: var(--bg-color); transform: translateY(-2px);
}
.cal-day.selected { background: var(--text-main); color: var(--bg-color); border-color: var(--text-main); font-weight: 600; }
.cal-header { border: none; color: var(--text-muted); font-size: 0.65rem; cursor: default; background: transparent; font-weight: 500; text-align: center; }
.cal-header:hover { background: transparent; transform: none; color: var(--text-muted); border-color: transparent; }
.cal-empty { pointer-events: none; background: transparent; border: none; }

/* --- ENVIRONMENT WIDGET --- */
.env-container { display: flex; flex-direction: column; height: 100%; justify-content: space-between; gap: 15px; padding-top: 5px; }
.env-header { display: flex; justify-content: space-between; align-items: center; }
.env-temp { font-size: 2.2rem; font-weight: 300; line-height: 1; }
.env-meta { text-align: right; }
.env-condition { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-sub); }
.env-location { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; margin-top: 4px; }

/* Forecast (Vertical List with Scroll) */
.forecast-wrapper {
    margin: 1.5rem 0;
}

.forecast-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 5px; 
    margin-bottom: 1.25rem;
}

/* Custom Scrollbar */
.forecast-grid::-webkit-scrollbar { width: 4px; }
.forecast-grid::-webkit-scrollbar-track { background: rgba(255, 255, 255, 0.05); }
.forecast-grid::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.2); border-radius: 2px; }

.forecast-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--input-bg); /* Use new visible background color */
    padding: 12px 15px;
    border-radius: 8px;
    transition: background 0.3s ease;
    flex-shrink: 0;
}

.forecast-item:hover { background: var(--card-hover); }
.forecast-time { font-size: 0.85rem; opacity: 0.8; margin: 0; font-weight: 400; width: 50px; }
.forecast-cond { font-size: 0.75rem; text-transform: uppercase; color: var(--text-sub); letter-spacing: 0.5px; flex-grow: 1; text-align: right; margin-right: 15px; opacity: 0.7; }
.forecast-temp { font-weight: 500; font-size: 1rem; width: 35px; text-align: right; }

.sun-times {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    opacity: 0.6;
    padding: 12px 5px 0 5px;
    border-top: 1px solid var(--border-color);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sun-time-val { font-weight: 600; color: var(--text-main); margin-left: 8px; }

.vitality-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.vitality-item { 
    background: var(--input-bg); /* Use new visible background color */
    border-radius: 8px; padding: 10px; text-align: center; 
}
.vitality-val { font-size: 1.1rem; font-weight: 400; color: var(--text-main); }
.vitality-label { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-top: 4px; }

/* --- SCRATCHPAD --- */
.notes-card { min-height: auto; }
.scratchpad-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.clear-btn {
    background: transparent; border: 1px solid var(--border-color); color: var(--text-muted);
    font-size: 0.5rem; text-transform: uppercase; letter-spacing: 1px; padding: 4px 10px;
    border-radius: 4px; transition: all 0.2s; cursor: pointer;
}
.clear-btn:hover { border-color: var(--accent-red); color: var(--accent-red); }
#scratchpad {
    width: 100%; resize: vertical; min-height: 120px;
    border: 1px solid var(--border-color); /* Added border back for visibility */
    background: var(--input-bg); /* Added background back for visibility */
    color: var(--text-main);
    font-family: inherit; outline: none; font-size: 0.9rem; line-height: 1.5;
    border-radius: 8px;
    padding: 10px;
}

/* --- RENEWALS TABLE --- */
.table-wrapper { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-top: 15px; }
.data-table { width: 100%; border-collapse: collapse; min-width: 650px; }
.data-table th { text-align: left; font-size: 0.6rem; text-transform: uppercase; letter-spacing: 2px; color: var(--text-muted); padding: 10px 0; border-bottom: 1px solid var(--border-color); font-weight: 500; }
.data-table td { padding: 18px 0; font-size: 0.85rem; color: var(--text-main); border-bottom: 1px solid rgba(255, 255, 255, 0.05); vertical-align: middle; }
.light-mode .data-table td { border-bottom: 1px solid rgba(0, 0, 0, 0.05); }
.data-table tr:last-child td { border-bottom: none; }
.mono-text { font-family: 'Space Mono', monospace; font-size: 0.8rem; letter-spacing: -0.5px; }
.status-cell { display: flex; align-items: center; justify-content: flex-end; gap: 15px; }
.days-text { font-family: 'Space Mono', monospace; font-size: 0.75rem; color: var(--text-sub); text-align: right; min-width: 80px; }
.progress-track { width: 100px; height: 6px; background: rgba(255, 255, 255, 0.1); border-radius: 4px; overflow: hidden; }
.light-mode .progress-track { background: rgba(0,0,0,0.1); }
.progress-fill { height: 100%; border-radius: 4px; transition: width 1s ease-in-out, background-color 0.3s ease; }
.fill-green { background-color: var(--accent-green); box-shadow: 0 0 10px rgba(76, 175, 80, 0.4); }
.fill-yellow { background-color: #ff9800; box-shadow: 0 0 10px rgba(255, 152, 0, 0.4); }
.fill-red { background-color: var(--accent-red); box-shadow: 0 0 10px rgba(211, 47, 47, 0.4); }
@keyframes pulse-red-anim { 0% { opacity: 1; box-shadow: 0 0 5px var(--accent-red); } 50% { opacity: 0.4; box-shadow: 0 0 15px var(--accent-red); } 100% { opacity: 1; box-shadow: 0 0 5px var(--accent-red); } }
.pulse-anim { animation: pulse-red-anim 1.5s infinite ease-in-out; }

/* --- EDITOR --- */
.edit-input { background: var(--input-bg); border: 1px solid var(--border-color); color: var(--text-main); font-family: 'Space Mono', monospace; padding: 8px; width: 100%; border-radius: 4px; font-size: 0.8rem; }
.action-btn { background: transparent; border: 1px solid var(--border-color); color: var(--text-muted); padding: 5px 10px; cursor: pointer; text-transform: uppercase; font-size: 0.6rem; letter-spacing: 1px; transition: all 0.2s; margin-left: 5px; }
.action-btn:hover { background: var(--text-main); color: var(--bg-color); }
.btn-delete:hover { border-color: var(--accent-red); background: var(--accent-red); color: white; }
.output-box { width: 100%; height: 200px; background: #111; color: #0f0; font-family: 'Space Mono', monospace; padding: 15px; border: 1px solid #333; margin-top: 20px; font-size: 0.8rem; resize: vertical; }
.light-mode .output-box { background: #eee; color: #000; border-color: #ccc; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; border-bottom: 1px solid var(--border-color); padding-bottom: 10px;}
.edit-row { display: grid; gap: 10px; margin-bottom: 10px; align-items: center; background: rgba(255,255,255,0.02); padding: 10px; border-radius: 8px;}

/* --- ANIMATIONS & RESPONSIVE --- */
@keyframes shine { to { background-position: 200% center; } }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 768px) {
    .signature-font { font-size: 3.5rem; line-height: 1.3; }
    .job-title { margin-top: 0; }
    .btn { width: 100%; display: block; }
    .credentials { margin-top: 60px; }
    .split-section { grid-template-columns: 1fr; }
    .header-section { flex-direction: column; align-items: center; text-align: center; gap: 10px; }
    .clocks-card { flex-direction: column; gap: 20px; padding: 20px; }
    .clock-item { border-right: none; border-bottom: 1px solid var(--border-color); padding-bottom: 15px; width: 100%; }
    .clock-item:last-child { border-bottom: none; padding-bottom: 0; }
    .calendar-grid { gap: 4px; }
    .controls-group { top: 20px; right: 20px; }
    
    /* MOBILE FIXES */
    .forecast-grid { max-height: 150px; } /* Reduce height on mobile to fit screen */
    .card { padding: 15px; } /* Slightly less padding to save space */
}