:root {
    --primary: #ffffff;
    --text-main: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.5);
    --bg-glass: rgba(255, 255, 255, 0.08);
    --bg-glass-heavy: rgba(15, 15, 15, 0.55);
    --border-glass: rgba(255, 255, 255, 0.08);
    --shadow-soft: 0 2px 20px rgba(0, 0, 0, 0.05);
    --overlay-opacity: 0.3;
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 20px;
    --transition-fast: 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
    --transition-normal: 0.35s cubic-bezier(0.25, 0.1, 0.25, 1);
}

[data-theme="light"] {
    --text-main: #1d1d1f;
    --text-muted: rgba(29, 29, 31, 0.45);
    --bg-glass: rgba(255, 255, 255, 0.35);
    --bg-glass-heavy: rgba(255, 255, 255, 0.6);
    --border-glass: rgba(255, 255, 255, 0.2);
    --shadow-soft: 0 2px 16px rgba(0, 0, 0, 0.04);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
}

body {
    min-height: 100vh;
    overflow: hidden;
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: color var(--transition-normal);
}

/* ========= Background ========= */
.bg-wrap {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -2;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
}

#bg-image {
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 1s ease;
    filter: blur(var(--bg-blur));
    transform: scale(1.05);
}

/* ========= Weather Overlay Effects ========= */
.weather-overlay-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: 10;
    opacity: 0;
    transition: opacity 1s ease;
}

.weather-overlay-layer.active {
    opacity: 1;
}

/* Chuva */
.weather-drop {
    position: absolute;
    width: 2px;
    height: 20px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.4));
    top: -20px;
    animation: rain linear infinite;
}

@keyframes rain {
    0% {
        transform: translateY(0) scaleY(1);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    90% {
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) scaleY(1.5);
        opacity: 0;
    }
}

/* Neve */
.weather-snow {
    position: absolute;
    background: #fff;
    border-radius: 50%;
    top: -10px;
    filter: blur(1px);
    animation: snow linear infinite;
}

@keyframes snow {
    0% {
        transform: translateY(0) translateX(0) scale(0.5);
        opacity: 0;
    }

    10% {
        opacity: 0.8;
    }

    90% {
        opacity: 0.8;
    }

    100% {
        transform: translateY(100vh) translateX(20px) scale(1);
        opacity: 0;
    }
}

/* Neblina */
.weather-fog {
    position: absolute;
    width: 200vw;
    height: 100vh;
    background: transparent url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="800" height="800"><filter id="f"><feTurbulence type="fractalNoise" baseFrequency="0.01" numOctaves="3"/></filter><rect width="100%" height="100%" filter="url(%23f)" opacity="0.3"/></svg>');
    opacity: 0.2;
    animation: fog 60s linear infinite alternate;
}

@keyframes fog {
    0% {
        transform: translateX(0);
    }

    100% {
        transform: translateX(-50vw);
    }
}

#bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, var(--overlay-opacity));
    z-index: -1;
    transition: background var(--transition-normal);
}

/* ========= Main Layout ========= */
.main-container {
    width: 90%;
    max-width: 1100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.8rem;
    padding: 1.5rem 0;
    animation: fadeUp 0.8s ease backwards;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ========= Glass (minimal) ========= */
.glass {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
}

.glass-heavy {
    background: var(--bg-glass-heavy);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
}

/* ========= Header / Clock ========= */
.header {
    text-align: center;
    animation: fadeIn 1s ease 0.2s backwards;
}

.time-container {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.4rem;
    font-weight: 200;
}

.clock {
    font-size: clamp(3.5rem, 7vw, 5.5rem);
    line-height: 1;
    letter-spacing: -3px;
}

.seconds {
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    opacity: 0.4;
    font-weight: 300;
}

.date {
    font-size: clamp(0.85rem, 1.6vw, 1rem);
    font-weight: 300;
    opacity: 0.6;
    margin-top: 0.4rem;
    text-transform: capitalize;
    letter-spacing: 0.3px;
}

.day-progress {
    width: 120px;
    height: 2px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    margin: 0.5rem auto 0;
    overflow: hidden;
}

[data-theme="light"] .day-progress {
    background: rgba(0, 0, 0, 0.06);
}

.day-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, rgba(100, 140, 255, 0.4), rgba(100, 200, 255, 0.6));
    border-radius: 2px;
    transition: width 1s ease;
}

.greeting {
    font-size: clamp(1.1rem, 2.2vw, 1.4rem);
    font-weight: 400;
    margin-top: 0.6rem;
    opacity: 0.85;
}

/* ========= Search Bar ========= */
.search-wrapper {
    display: flex;
    justify-content: center;
    width: 100%;
    animation: fadeIn 1s ease 0.4s backwards;
}

#search-form {
    width: 100%;
    max-width: 520px;
    position: relative;
}

.search-math-result {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    padding: 0.8rem 1.2rem;
    display: flex;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background var(--transition-fast);
    z-index: 50;
    animation: fadeIn 0.2s ease;
}

.search-math-result:hover {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .search-math-result:hover {
    background: rgba(0, 0, 0, 0.05);
}

.search-box {
    display: flex;
    align-items: center;
    padding: 0.65rem 1.2rem;
    border-radius: 50px;
    transition: all var(--transition-normal);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.search-box:focus-within {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

[data-theme="light"] .search-box {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

[data-theme="light"] .search-box:focus-within {
    background: rgba(255, 255, 255, 0.45);
    border-color: rgba(0, 0, 0, 0.15);
}

.search-icon {
    font-size: 0.95rem;
    margin-right: 10px;
    opacity: 0.4;
}

#search-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-main);
    font-size: 0.95rem;
    font-weight: 300;
}

#search-input::placeholder {
    color: var(--text-muted);
}

/* ========= Quick Links ========= */
.links-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
    animation: fadeIn 1s ease 0.5s backwards;
}

.links-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
    --max-links: 10;
    max-width: calc(var(--max-links) * 86px);
}

.link-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.7rem 0.5rem;
    width: 80px;
    text-decoration: none;
    color: var(--text-main);
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    position: relative;
    background: transparent;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}

.link-card:hover {
    transform: translateY(-3px);
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .link-card:hover {
    background: rgba(0, 0, 0, 0.06);
}

.link-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    object-fit: contain;
    opacity: 0.9;
}

.link-name {
    font-size: 0.7rem;
    text-align: center;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    opacity: 0.7;
}

.link-cat-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    opacity: 0.6;
    flex-shrink: 0;
}

.add-link-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 400;
    cursor: pointer;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    transition: all var(--transition-fast);
    font-family: inherit;
    opacity: 0.5;
}

.add-link-btn:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.08);
}

/* Link edit mode */
.remove-link-btn {
    position: absolute;
    top: -4px;
    right: -4px;
    background: rgba(255, 71, 87, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
}

.links-grid.edit-mode .remove-link-btn {
    display: flex;
}

.links-grid.edit-mode .link-card {
    animation: shake 0.3s infinite alternate;
}

@keyframes shake {
    0% {
        transform: rotate(-1deg);
    }

    100% {
        transform: rotate(1deg);
    }
}

/* ========= Content Grid (Widgets) ========= */
.content-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1rem;
    width: 100%;
    animation: fadeIn 1s ease 0.6s backwards;
    align-items: stretch;
}

.widget {
    padding: 1rem 1.1rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-md);
    position: relative;
}

[data-theme="light"] .widget {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.15);
}

.widget h3 {
    font-size: 0.8rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========= Weather ========= */
#weather-widget {
    min-height: 80px;
    justify-content: center;
}

.weather-info {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.weather-main {
    display: flex;
    align-items: center;
    gap: 8px;
}

.weather-temp {
    font-size: 2rem;
    font-weight: 500;
}

.weather-icon {
    font-size: 2rem;
    opacity: 0.8;
}

.weather-desc {
    font-size: 0.85rem;
    text-transform: capitalize;
    opacity: 0.7;
    font-weight: 300;
}

.weather-details {
    font-size: 0.75rem;
    opacity: 0.5;
    display: flex;
    flex-direction: column;
    gap: 1px;
    font-weight: 300;
}

.weather-update-time {
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 0.65rem;
    opacity: 0.4;
    font-weight: 300;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border-radius: 4px;
    user-select: none;
}

.weather-update-time:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="light"] .weather-update-time:hover {
    background: rgba(0, 0, 0, 0.05);
}

.weather-update-time:active {
    transform: scale(0.95);
}

.weather-update-time i.loading {
    animation: spin 1s linear infinite;
}

.spin {
    display: inline-block;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* ========= Notes ========= */
#quick-notes {
    width: 100%;
    height: 90px;
    background: transparent;
    border: none;
    color: var(--text-main);
    resize: none;
    outline: none;
    font-size: 0.85rem;
    line-height: 1.5;
    font-weight: 300;
    opacity: 0.85;
}

#quick-notes::placeholder {
    color: var(--text-muted);
}

/* ========= Todo ========= */
.todo-input-group {
    display: flex;
    gap: 0.4rem;
}

#todo-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    padding: 0.4rem 0.7rem;
    color: var(--text-main);
    outline: none;
    font-size: 0.85rem;
    font-weight: 300;
}

[data-theme="light"] #todo-input {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
}

#todo-input::placeholder {
    color: var(--text-muted);
}

.todo-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 140px;
    overflow-y: auto;
    padding-right: 4px;
}

.todo-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 300;
    padding: 6px 8px;
    border-radius: 8px;
    transition: var(--transition-fast);
}

.todo-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

[data-theme="light"] .todo-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

.todo-item input[type="checkbox"] {
    accent-color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    opacity: 0.6;
}

.todo-item span {
    flex: 1;
    word-break: break-word;
    opacity: 0.8;
}

.todo-item.completed span {
    text-decoration: line-through;
    opacity: 0.3;
}

.todo-item .del-todo {
    cursor: pointer;
    opacity: 0;
    background: none;
    border: none;
    color: inherit;
    font-size: 0.9rem;
    transition: opacity var(--transition-fast);
}

.todo-item:hover .del-todo {
    opacity: 0.4;
}

.todo-item .del-todo:hover {
    opacity: 1;
    color: #ff4757;
}

/* ========= Scrollbar ========= */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
}

/* ========= Buttons ========= */
.glass-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 400;
    transition: all var(--transition-fast);
}

.glass-btn:hover {
    background: rgba(255, 255, 255, 0.14);
}

[data-theme="light"] .glass-btn {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .glass-btn:hover {
    background: rgba(0, 0, 0, 0.1);
}

.glass-btn.primary {
    background: rgba(100, 140, 255, 0.2);
    border-color: rgba(100, 140, 255, 0.3);
}

.glass-btn.primary:hover {
    background: rgba(100, 140, 255, 0.35);
}

.glass-btn.danger {
    background: rgba(255, 71, 87, 0.2);
    border-color: rgba(255, 71, 87, 0.3);
}

.glass-btn.danger:hover {
    background: rgba(255, 71, 87, 0.35);
}

.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.block-btn {
    width: 100%;
    padding: 0.7rem;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    padding: 0;
}

/* ========= Floating Controls ========= */
.floating-controls {
    position: fixed;
    display: flex;
    gap: 8px;
    z-index: 100;
}

.floating-controls.right {
    bottom: 16px;
    right: 16px;
    flex-direction: column;
}

.floating-controls.top-right {
    top: 16px;
    right: 16px;
}

.floating-controls.top-right .glass-btn {
    opacity: 0.3;
    transition: opacity var(--transition-fast), background var(--transition-fast);
}

.floating-controls.top-right .glass-btn:hover {
    opacity: 0.8;
}

.floating-controls.top-right .glass-btn.active {
    opacity: 0.9;
    color: #ff6b6b;
}

.floating-controls.right .glass-btn {
    opacity: 0.3;
    transition: opacity var(--transition-fast), background var(--transition-fast);
}

.floating-controls.right .glass-btn:hover {
    opacity: 0.8;
}

.floating-controls.bottom {
    bottom: 16px;
    left: 16px;
}

.unsplash-credit {
    padding: 4px 10px;
    font-size: 0.65rem;
    border-radius: 20px;
    opacity: 0.3;
    transition: opacity var(--transition-fast);
}

.unsplash-credit:hover {
    opacity: 0.7;
}

.unsplash-credit a {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 400;
}

.unsplash-credit a:hover {
    text-decoration: underline;
}

/* ========= Sidebar Settings ========= */
.sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 340px;
    max-width: 100vw;
    height: 100vh;
    z-index: 200;
    padding: 1.8rem;
    display: flex;
    flex-direction: column;
    transition: right 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    border-right: none;
}

.sidebar.open {
    right: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.sidebar-header h2 {
    font-size: 1rem;
    font-weight: 500;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    padding-right: 8px;
}

.settings-footer {
    text-align: center;
    font-size: 0.7rem;
    opacity: 0.25;
    font-weight: 300;
    padding-top: 1rem;
    margin-top: auto;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.setting-group label {
    font-size: 0.8rem;
    font-weight: 400;
    opacity: 0.7;
}

.setting-hint {
    font-size: 0.65rem;
    font-weight: 300;
    opacity: 0.4;
    line-height: 1.4;
}

.setting-hint a {
    color: rgba(100, 180, 255, 0.8);
    text-decoration: none;
}

.setting-hint a:hover {
    text-decoration: underline;
}

.setting-group input[type="text"],
.setting-group input[type="url"],
.setting-group input[type="number"],
.setting-group input[type="password"],
.setting-group select {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 0.5rem 0.7rem;
    border-radius: var(--radius-sm);
    outline: none;
    font-size: 0.85rem;
    font-weight: 300;
    font-family: inherit;
    transition: border-color var(--transition-fast), background var(--transition-fast);
    -moz-appearance: textfield;
    appearance: textfield;
}

.setting-group input[type="number"]::-webkit-outer-spin-button,
.setting-group input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.setting-group input:focus,
.setting-group select:focus {
    border-color: rgba(100, 140, 255, 0.4);
    background: rgba(255, 255, 255, 0.12);
}

.setting-group select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='rgba(255,255,255,0.4)'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    padding-right: 2rem;
}

select option {
    background-color: #1f1f1f;
    color: #ffffff;
}

select optgroup {
    background-color: #1f1f1f;
    color: rgba(255, 255, 255, 0.45);
    font-weight: 600;
    font-style: normal;
    font-size: 0.75rem;
}

[data-theme="light"] select option {
    background-color: #ffffff;
    color: #1d1d1f;
}

[data-theme="light"] select optgroup {
    background-color: #ffffff;
    color: rgba(0, 0, 0, 0.4);
}

[data-theme="light"] .setting-group input[type="text"],
[data-theme="light"] .setting-group input[type="url"],
[data-theme="light"] .setting-group input[type="number"],
[data-theme="light"] .setting-group input[type="password"],
[data-theme="light"] .setting-group select {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .setting-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='rgba(0,0,0,0.3)'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
}

[data-theme="light"] .setting-group input:focus,
[data-theme="light"] .setting-group select:focus {
    background: rgba(0, 0, 0, 0.06);
}

.setting-group.toggle-group {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.15);
    transition: .3s;
}

[data-theme="light"] .slider {
    background-color: rgba(0, 0, 0, 0.15);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
}

input:checked+.slider {
    background-color: rgba(100, 140, 255, 0.5);
}

input:checked+.slider:before {
    transform: translateX(18px);
}

.slider.round {
    border-radius: 22px;
}

.slider.round:before {
    border-radius: 50%;
}

.range {
    width: 100%;
    accent-color: rgba(100, 140, 255, 0.7);
}

.separator {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin: 0.3rem 0;
}

[data-theme="light"] .separator {
    border-top-color: rgba(0, 0, 0, 0.06);
}

/* ========= Modal ========= */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.active {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    width: 90%;
    max-width: 420px;
    padding: 1.8rem;
    transform: translateY(15px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal.active .modal-content {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.2rem;
}

.modal-header h2 {
    font-size: 1rem;
    font-weight: 500;
}

.add-link-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.add-link-form input,
.add-link-form select {
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    padding: 0.6rem 0.8rem;
    border-radius: var(--radius-sm);
    outline: none;
    font-size: 0.85rem;
    font-weight: 300;
    font-family: inherit;
    transition: border-color var(--transition-fast);
}

.add-link-form input:focus,
.add-link-form select:focus {
    border-color: rgba(100, 140, 255, 0.4);
}

.add-link-form select {
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='rgba(255,255,255,0.4)'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    padding-right: 2rem;
}

[data-theme="light"] .add-link-form input,
[data-theme="light"] .add-link-form select {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
}

#manage-links-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 220px;
    overflow-y: auto;
}

.manage-link-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border-radius: 8px;
    transition: background var(--transition-fast);
}

.manage-link-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .manage-link-item:hover {
    background: rgba(0, 0, 0, 0.04);
}

.manage-link-info {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.manage-link-info img {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    opacity: 0.8;
}

.manage-link-info span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
    font-size: 0.85rem;
    font-weight: 300;
}

/* ========= Toast ========= */
.toast {
    position: fixed;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    z-index: 1000;
    transition: bottom 0.4s ease;
    font-size: 0.8rem;
    font-weight: 400;
}

.toast.show {
    bottom: 24px;
}

/* ========= Responsive: Low height (1360x768) ========= */
@media (max-height: 720px) {
    .main-container {
        padding: 8px 0;
        gap: 1.2rem;
        max-height: 100vh;
    }

    .clock {
        font-size: clamp(2.5rem, 5vw, 3.5rem);
    }

    .greeting {
        margin-top: 3px;
        font-size: clamp(0.95rem, 1.6vw, 1.2rem);
    }

    .search-wrapper {
        margin-top: -5px;
    }

    .content-grid {
        gap: 0.8rem;
    }

    .widget {
        padding: 0.8rem 0.9rem;
    }

    #quick-notes {
        height: 60px;
    }

    .todo-list {
        max-height: 100px;
    }

    .links-section {
        gap: 0.4rem;
    }

    .link-card {
        padding: 0.5rem 0.4rem;
        width: 70px;
    }

    .link-icon {
        width: 24px;
        height: 24px;
    }

    .link-name {
        font-size: 0.65rem;
    }
}

/* ========= Responsive: Tablet ========= */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr 1fr;
    }

    #weather-widget {
        grid-column: span 2;
    }
}

/* ========= Responsive: Mobile ========= */
@media (max-width: 768px) {
    body {
        overflow-y: auto;
    }

    .content-grid {
        grid-template-columns: 1fr;
    }

    #weather-widget {
        grid-column: span 1;
    }

    .clock {
        font-size: 3.5rem;
    }

    .sidebar {
        width: 100vw;
        border-radius: 0;
    }
}

/* ========= Pomodoro Timer ========= */
.pomodoro-toggle {
    transition: opacity var(--transition-fast), color var(--transition-fast);
}

.pomodoro-toggle:hover {
    opacity: 0.7 !important;
}

.pomodoro-toggle.active {
    opacity: 0.9 !important;
    color: #ff6b6b;
}

.pomodoro-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 250;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.pomodoro-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.pomodoro-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 2.5rem 3rem;
    background: rgba(20, 20, 20, 0.6);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-lg);
    position: relative;
    min-width: 340px;
    transform: translateY(15px);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] .pomodoro-card {
    background: rgba(255, 255, 255, 0.65);
}

.pomodoro-overlay.active .pomodoro-card {
    transform: translateY(0);
}

.pomodoro-close {
    position: absolute;
    top: 12px;
    right: 12px;
}

.pomodoro-mode {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 500;
    opacity: 0.5;
}

.pomodoro-display {
    font-size: 5rem;
    font-weight: 200;
    letter-spacing: -2px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
    text-align: center;
    min-width: 250px;
}

.pomodoro-controls {
    display: flex;
    gap: 0.8rem;
}

.pomodoro-controls .glass-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    padding: 0;
}

.pomodoro-cycles {
    font-size: 0.8rem;
    opacity: 0.4;
    font-weight: 300;
    margin-top: -0.8rem;
}

.pomodoro-dismiss {
    animation: pulse-alarm 1s infinite;
    font-size: 0.85rem;
    padding: 0.5rem 1.2rem;
    border-radius: 50px;
    background: rgba(255, 71, 87, 0.3);
    border-color: rgba(255, 71, 87, 0.5);
}

.pomodoro-dismiss:hover {
    background: rgba(255, 71, 87, 0.5);
}

@keyframes pulse-alarm {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
        box-shadow: 0 0 20px rgba(255, 71, 87, 0.3);
    }
}

.pomodoro-phases {
    display: flex;
    gap: 0.4rem;
}

.pomodoro-phase {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    padding: 0.4rem 0.7rem;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 400;
    cursor: pointer;
    opacity: 0.4;
    transition: all var(--transition-fast);
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 4px;
}

.pomodoro-phase:hover {
    opacity: 0.7;
}

.pomodoro-phase.active {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

[data-theme="light"] .pomodoro-phase.active {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.15);
}

.phase-label {
    pointer-events: none;
}

.phase-input {
    width: 32px;
    background: transparent;
    border: none;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    color: var(--text-main);
    font-size: 0.7rem;
    font-family: inherit;
    text-align: center;
    outline: none;
    padding: 1px 0;
    -moz-appearance: textfield;
    appearance: textfield;
}

.phase-input::-webkit-outer-spin-button,
.phase-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.phase-input:focus {
    border-bottom-color: rgba(100, 140, 255, 0.6);
}

[data-theme="light"] .phase-input {
    border-bottom-color: rgba(0, 0, 0, 0.15);
}

.pomodoro-hint {
    font-size: 0.65rem;
    opacity: 0.25;
    font-weight: 300;
    margin-top: -0.5rem;
}

/* ========= Time-Based Theme Gradients ========= */
.bg-wrap {
    transition: background 2s ease;
}

body[data-time-theme="dawn"] .bg-wrap {
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 40%, #24243e 100%);
}

body[data-time-theme="morning"] .bg-wrap {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 30%, #ffd89b 100%);
}

body[data-time-theme="noon"] .bg-wrap {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

body[data-time-theme="afternoon"] .bg-wrap {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

body[data-time-theme="evening"] .bg-wrap {
    background: linear-gradient(135deg, #a18cd1 0%, #fbc2eb 50%, #f6a085 100%);
}

body[data-time-theme="night"] .bg-wrap {
    background: linear-gradient(135deg, #0c0c1d 0%, #1a1a3e 40%, #2d1b69 100%);
}

/* ========= Top-Left Controls ========= */
.floating-controls.top-left {
    top: 16px;
    left: 16px;
}

.floating-controls.top-left .glass-btn {
    opacity: 0.3;
    transition: opacity var(--transition-fast), background var(--transition-fast);
}

.floating-controls.top-left .glass-btn:hover {
    opacity: 0.8;
}

/* ========= Timer Tabs ========= */
.timer-tabs {
    display: flex;
    gap: 0;
    border-radius: 20px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 0.5rem;
}

.timer-tab,
.conv-tab {
    background: transparent;
    border: none;
    color: var(--text-main);
    padding: 0.35rem 1rem;
    font-size: 0.7rem;
    font-weight: 400;
    cursor: pointer;
    opacity: 0.4;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.timer-tab.active,
.conv-tab.active {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.timer-tab-content,
.conv-content {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    width: 100%;
}

.timer-tab-content.active,
.conv-content.active {
    display: flex;
}

/* ========= Stopwatch ========= */
.stopwatch-ms {
    font-size: 2rem;
    opacity: 0.4;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
}

.sw-laps {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 120px;
    overflow-y: auto;
    width: 100%;
    padding: 0 1rem;
}

.sw-laps li {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 300;
    opacity: 0.6;
    padding: 3px 8px;
    border-radius: 6px;
}

.sw-laps li:nth-child(odd) {
    background: rgba(255, 255, 255, 0.03);
}

/* ========= Calendar ========= */
.calendar-card {
    min-width: 320px;
    max-width: 360px;
}

.cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 0.5rem;
}

.cal-title {
    font-size: 0.95rem;
    font-weight: 500;
    text-transform: capitalize;
}

.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    width: 100%;
    text-align: center;
    font-size: 0.65rem;
    font-weight: 500;
    opacity: 0.4;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    width: 100%;
    gap: 2px;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 300;
    border-radius: 8px;
    cursor: default;
    opacity: 0.6;
    position: relative;
}

.cal-day.other-month {
    opacity: 0.15;
}

.cal-day.today {
    background: rgba(100, 140, 255, 0.3);
    opacity: 1;
    font-weight: 500;
}

.cal-day.holiday {
    color: #ff6b6b;
    opacity: 1;
    font-weight: 500;
}

.cal-day.holiday::after {
    content: '';
    position: absolute;
    bottom: 2px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #ff6b6b;
}

.cal-holidays {
    width: 100%;
    margin-top: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-height: 100px;
    overflow-y: auto;
}

.cal-holiday-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 300;
    opacity: 0.7;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(255, 71, 107, 0.08);
}

.cal-holiday-item .cal-holiday-date {
    font-weight: 500;
    opacity: 0.9;
    min-width: 40px;
}

/* ========= Converter ========= */
.converter-card {
    min-width: 280px;
}

.conv-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.conv-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.7rem;
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 300;
    font-family: inherit;
    outline: none;
    -moz-appearance: textfield;
    appearance: textfield;
}

.conv-input::-webkit-outer-spin-button,
.conv-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.conv-input:focus {
    border-color: rgba(100, 140, 255, 0.4);
}

.conv-input[readonly] {
    opacity: 0.6;
}

[data-theme="light"] .conv-input {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.08);
}

.conv-label {
    font-size: 0.8rem;
    font-weight: 500;
    opacity: 0.5;
    min-width: 30px;
    text-align: right;
}

.conv-rate-info {
    font-size: 0.65rem;
    opacity: 0.3;
    font-weight: 300;
    text-align: center;
}

/* ========= Zen Mode ========= */

/* Esconder tudo menos o header, busca e o botão zen */
body.zen-mode .search-wrapper {
    opacity: 1;
    transition: opacity 0.8s ease 0.3s;
}

body.zen-mode .links-section {
    opacity: 0;
    pointer-events: none;
    height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
    transition: opacity 0.5s ease 0.1s;
}

body.zen-mode .content-grid {
    opacity: 0;
    pointer-events: none;
    height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
    transition: opacity 0.5s ease 0.15s;
}

body.zen-mode .floating-controls.top-left,
body.zen-mode .floating-controls.top-right,
body.zen-mode .floating-controls.bottom {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

/* O container vira um flexbox centralizado */
body.zen-mode .main-container {
    justify-content: center;
    min-height: 100vh;
    gap: 2rem;
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Header centralizado verticalmente */
body.zen-mode .header {
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Relógio maior e mais elegante no zen */
body.zen-mode .clock {
    font-size: clamp(5rem, 12vw, 9rem);
    transition: font-size 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

body.zen-mode .seconds {
    font-size: clamp(1.5rem, 3.5vw, 2.5rem);
    transition: font-size 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

body.zen-mode .date {
    font-size: clamp(1rem, 2vw, 1.3rem);
    opacity: 0.5;
    margin-top: 0.8rem;
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

body.zen-mode .day-progress {
    width: 180px;
    margin-top: 1rem;
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

body.zen-mode .greeting {
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    margin-top: 1rem;
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Botões flutuantes à direita - quase invisíveis */
body.zen-mode .floating-controls.right {
    opacity: 0.08;
    transition: opacity 0.5s ease;
}

body.zen-mode .floating-controls.right:hover {
    opacity: 0.6;
}

body.zen-mode .floating-controls.right .icon-btn:not(#zen-toggle) {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

body.zen-mode .floating-controls.right:hover .icon-btn:not(#zen-toggle) {
    opacity: 1;
    pointer-events: all;
}

/* Botão zen ativo - brilho sutil */
body.zen-mode #zen-toggle {
    opacity: 1 !important;
    color: rgba(160, 200, 255, 0.9);
}

/* Transições de saída do zen */
body:not(.zen-mode) .header {
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

body:not(.zen-mode) .clock {
    transition: font-size 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

body:not(.zen-mode) .seconds {
    transition: font-size 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

body:not(.zen-mode) .search-wrapper,
body:not(.zen-mode) .links-section,
body:not(.zen-mode) .content-grid {
    transition: opacity 0.5s ease, transform 0.5s ease;
}

body:not(.zen-mode) .main-container {
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ========= Link Category Headers ========= */
.link-category-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    width: 100%;
}

.link-category-header {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.3;
    font-weight: 500;
    cursor: pointer;
    transition: opacity var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 4px;
}

.link-category-header:hover {
    opacity: 0.6;
}

.link-category-header i {
    font-size: 0.5rem;
    transition: transform var(--transition-fast);
}

.link-category-group.collapsed .link-category-header i {
    transform: rotate(-90deg);
}

.link-category-group.collapsed .links-grid {
    display: none;
}

/* ========= Favorite Background Button (next to credits) ========= */
.fav-bg-credit-btn {
    background: none;
    border: none;
    color: var(--text-main);
    font-size: 0.85rem;
    cursor: pointer;
    opacity: 0.4;
    transition: all var(--transition-fast);
    padding: 4px 6px;
    border-radius: 50%;
}

.fav-bg-credit-btn:hover {
    opacity: 0.9;
    transform: scale(1.15);
}

.fav-bg-credit-btn.fav-active {
    color: #ff6b6b;
    opacity: 0.45;
}

.fav-bg-credit-btn.fav-active i {
    animation: heartPop 0.4s ease;
}

@keyframes heartPop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.4);
    }

    100% {
        transform: scale(1);
    }
}

/* ========= Chat IA ========= */
.chat-card {
    min-width: 450px;
    max-width: 850px;
    width: 90vw;
    height: 85vh;
    max-height: 900px;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 1.8rem !important;
}

.chat-header {
    font-size: 1.1rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.2rem;
    opacity: 0.8;
}

.chat-model-label {
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.6;
    background: rgba(255, 255, 255, 0.08);
    padding: 4px 12px;
    border-radius: 20px;
    margin-left: auto;
}

[data-theme="light"] .chat-model-label {
    background: rgba(0, 0, 0, 0.06);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    /* Permite que filhos ocupem a largura toda e se centralizem */
    gap: 1.2rem;
    padding: 1.5rem;
    min-height: 200px;
    scroll-behavior: smooth;
    width: 100%;
}

.chat-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
    height: 100%;
    text-align: center;
    padding: 2rem;
    gap: 12px;
}

.chat-empty i.fa-key {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: #ffd700;
    opacity: 0.6;
}

.chat-empty h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 400;
    opacity: 0.9;
}

.chat-empty p {
    margin: 0;
    font-size: 0.75rem;
    opacity: 0.5;
}

.chat-empty .glass-btn {
    margin-top: 1rem;
    opacity: 0.5;
    font-size: 0.75rem;
    padding: 8px 16px;
    transition: opacity 0.3s ease;
}

.chat-empty .glass-btn:hover {
    opacity: 1;
}

.chat-msg {
    padding: 1rem 1.4rem;
    border-radius: 22px;
    font-size: 0.92rem;
    font-weight: 300;
    line-height: 1.6;
    max-width: 85%;
    width: fit-content;
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.chat-msg p {
    margin: 0.8rem 0;
}

.chat-msg p:first-child,
.chat-msg h1:first-child,
.chat-msg h2:first-child,
.chat-msg h3:first-child {
    margin-top: 0;
}

.chat-msg p:last-child,
.chat-msg ul:last-child,
.chat-msg ol:last-child {
    margin-bottom: 0;
}

.chat-msg h1,
.chat-msg h2,
.chat-msg h3 {
    margin: 1.2rem 0 0.6rem 0;
    line-height: 1.4;
    font-weight: 600;
}

.chat-msg p,
.chat-msg ul,
.chat-msg ol {
    margin: 0.6rem 0;
}

.chat-msg h1:first-child,
.chat-msg h2:first-child,
.chat-msg h3:first-child,
.chat-msg p:first-child {
    margin-top: 0;
}

.chat-msg h1:last-child,
.chat-msg h2:last-child,
.chat-msg h3:last-child,
.chat-msg p:last-child,
.chat-msg ul:last-child {
    margin-bottom: 0;
}

.chat-msg h1 {
    font-size: 1.15rem;
}

.chat-msg h2 {
    font-size: 1.05rem;
}

.chat-msg h3 {
    font-size: 0.95rem;
}

.chat-msg ul {
    margin: 0.5rem 0;
    padding-left: 1.2rem;
}

.chat-msg li {
    margin-bottom: 0.2rem;
}

.chat-hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 0.8rem 0;
}

[data-theme="light"] .chat-hr {
    border-top-color: rgba(0, 0, 0, 0.1);
}

.chat-msg-user {
    align-self: flex-end;
    /* Colado na direita */
    background: rgba(100, 140, 255, 0.2);
    border: 1px solid rgba(100, 140, 255, 0.2);
    border-bottom-right-radius: 4px;
    color: #e0eaff;
    margin-left: auto;
    /* Garante que empurre tudo pra esquerda */
}

.chat-msg-ai {
    align-self: flex-start;
    /* Colado na esquerda */
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom-left-radius: 4px;
    margin-right: auto;
}

[data-theme="light"] .chat-msg-user {
    background: rgba(100, 140, 255, 0.15);
    border-color: rgba(100, 140, 255, 0.1);
}

[data-theme="light"] .chat-msg-ai {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.06);
}

.chat-msg pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.6rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.4rem 0;
    font-size: 0.75rem;
}

[data-theme="light"] .chat-msg pre {
    background: rgba(0, 0, 0, 0.06);
}

.chat-msg code.inline-code {
    background: rgba(255, 255, 255, 0.1);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.78rem;
}

[data-theme="light"] .chat-msg code.inline-code {
    background: rgba(0, 0, 0, 0.06);
}

.chat-msg strong {
    font-weight: 600;
}

/* Typing indicator */
.chat-typing {
    display: flex;
    gap: 4px;
    padding: 0.7rem 1rem;
    align-items: center;
}

.typing-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-main);
    opacity: 0.4;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: translateY(0);
        opacity: 0.3;
    }

    40% {
        transform: translateY(-6px);
        opacity: 0.8;
    }
}

.chat-input-area {
    display: flex;
    gap: 12px;
    margin-top: 1.2rem;
    width: 100%;
    align-items: center;
}

.chat-input-area input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 25px;
    padding: 0.8rem 1.5rem;
    color: var(--text-main);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.3s ease;
}

.chat-input-area input:focus {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(100, 140, 255, 0.4);
    box-shadow: 0 0 0 4px rgba(100, 140, 255, 0.1);
}

#chat-send-btn {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    color: var(--text-main);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

#chat-send-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--accent-main);
    color: var(--accent-main);
}

#chat-send-btn:active {
    transform: scale(0.95);
}

#chat-send-btn i {
    transform: translate(-1px, 1px);
}

/* Estilos para o tema claro no input */
[data-theme="light"] .chat-input-area input {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
}

.chat-input-area input::placeholder {
    color: var(--text-muted);
}


.chat-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 1rem;
    padding-top: 0.8rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-actions .glass-btn {
    font-size: 0.75rem;
    padding: 6px 16px;
    border-radius: 30px;
    opacity: 0.6;
    display: flex;
    align-items: center;
    gap: 6px;
}

.chat-actions .glass-btn:hover {
    opacity: 1;
}

.glass-btn.danger {
    color: #ff6b6b;
    background: rgba(255, 107, 107, 0.1);
    border-color: rgba(255, 107, 107, 0.2);
}

.glass-btn.danger:hover {
    background: rgba(255, 107, 107, 0.2);
    border-color: rgba(255, 107, 107, 0.4);
}

/* Zen mode: esconder botão de chat */
body.zen-mode .floating-controls.right .icon-btn:not(#zen-toggle) {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

body.zen-mode .floating-controls.right:hover .icon-btn:not(#zen-toggle) {
    opacity: 1;
    pointer-events: all;
}

/* ========= Settings hint for Gemini ========= */
.setting-hint {
    font-size: 0.7rem;
    opacity: 0.4;
    font-weight: 300;
    margin-top: 4px;
    display: block;
}

.setting-hint a {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .chat-card {
        min-width: auto;
        width: 95vw;
        max-height: 85vh;
    }
}