:root {
    --primary: #10b981;
    --primary-hover: #059669;
    --bg-dark: #0a0a0a;
    --bg-card: #141414;
    --border: #262626;
    --text-main: #f3f4f6;
    --text-dim: #9ca3af;
    --glass: rgba(20, 20, 20, 0.7);
    --editor-bg: #1e1e1e;
}

[data-theme="light"] {
    --bg-dark: #f8fafc;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --text-main: #1e293b;
    --text-dim: #64748b;
    --glass: rgba(255, 255, 255, 0.8);
    --editor-bg: #fdfdfd;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Nav Styles */
nav {
    padding: 1rem 2rem;
    background: var(--glass);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
}

.logo-img {
    height: 32px;
    width: auto;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-dim);
    padding: 0.6rem 1.2rem;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.nav-btn.active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary);
}

/* Main Layout */
main {
    flex: 1;
    padding: 2rem;
    max-width: 100%;
    /* Use full width */
    margin: 0;
    width: 100%;
    overflow-y: hidden;
    /* Main shouldn't scroll, inner sections will */
}

.tool-section {
    display: none;
    height: calc(100vh - 100px);
    /* Flex height based on viewport */
    animation: fadeIn 0.3s ease-out;
}

.tool-section.active {
    display: flex;
    flex-direction: column;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Editor Layout */
.workspace {
    display: flex;
    gap: 1rem;
    height: 100%;
    min-height: 0;
}

.editor-box {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 1rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.editor-header {
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.editor-title {
    font-size: 0.875rem;
    color: var(--text-dim);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.editor-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 0.4rem;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: 0.2s;
}

.action-btn:hover {
    background: var(--primary-hover);
}

.monaco-wrapper {
    flex: 1;
    width: 100%;
}

/* Controls */
.controls {
    margin-bottom: 1rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

select,
input {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    outline: none;
}

/* Todo App */
.todo-container {
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

.todo-input-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.todo-input-group input {
    flex: 1;
}

.todo-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.todo-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 1rem;
    border-radius: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: 0.2s;
}

.todo-item:hover {
    border-color: var(--primary);
}

.todo-text {
    flex: 1;
    margin-right: 1rem;
}

.todo-text.done {
    text-decoration: line-through;
    color: var(--text-dim);
}

/* Alarm System */
.alarm-container {
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
}

.current-time {
    font-size: 4rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--primary);
    font-family: 'Fira Code', monospace;
}

.alarm-form {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 1.5rem;
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.alarm-list {
    margin-top: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    nav {
        padding: 0.75rem 1rem;
        gap: 1rem;
        justify-content: space-between;
    }

    .logo span {
        display: none;
    }

    .nav-links {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--glass);
        backdrop-filter: blur(20px);
        padding: 0.5rem;
        border-top: 1px solid var(--border);
        justify-content: space-around;
        gap: 0;
        z-index: 1000;
    }

    .nav-btn {
        flex-direction: column;
        font-size: 0.7rem;
        padding: 0.5rem;
        gap: 0.2rem;
    }

    .nav-btn i {
        font-size: 1.2rem;
    }

    main {
        padding: 1rem;
        padding-bottom: 5rem;
        /* Space for mobile nav */
    }

    .workspace {
        flex-direction: column;
    }

    .editor-box {
        height: 45vh;
    }

    .user-profile {
        font-size: 0.8rem;
        gap: 0.5rem;
    }
}

/* Auth & Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 2.5rem;
    border-radius: 1.5rem;
    width: 450px;
    max-width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    position: relative;
    animation: slideDown 0.3s ease-out;
}

.modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-size: 1.5rem;
    cursor: pointer;
    transition: 0.2s;
}

.modal-close-btn:hover {
    color: var(--primary);
}

.modal h2 {
    margin-bottom: 2rem;
    text-align: center;
    color: var(--primary);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-dim);
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    width: 100%;
}

/* Settings View */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: 1rem;
}

/* Enhanced Todo */
.todo-cat-badge {
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    margin-right: 0.75rem;
}

.todo-item {
    cursor: grab;
}

.todo-item:active {
    cursor: grabbing;
}

.sortable-ghost {
    opacity: 0.4;
    background: var(--primary) !important;
}

/* Enhanced Alarm */
.ringtone-selector {
    margin-top: 1rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.clock-container {
    cursor: pointer;
    user-select: none;
    transition: transform 0.2s;
}

.clock-container:active {
    transform: scale(0.95);
}

/* User Info in Nav */
.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-left: auto;
    padding-left: 1rem;
    border-left: 1px solid var(--border);
}

.logout-btn {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    padding: 0.4rem 0.8rem;
    border-radius: 0.5rem;
    cursor: pointer;
}

.logout-btn:hover {
    background: #ef4444;
    color: white;
}

/* NEW REFINEMENT STYLES */

/* Alarm Alert Overlay */
#alarm-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw;
    height: 100vh;
    background: rgba(16, 185, 129, 0.95);
    z-index: 9999;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    text-align: center;
    animation: pulseBg 1.5s infinite;
}

@keyframes pulseBg {
    0% {
        background: rgba(16, 185, 129, 0.9);
    }

    50% {
        background: rgba(239, 68, 68, 0.9);
    }

    100% {
        background: rgba(16, 185, 129, 0.9);
    }
}

.alarm-icon-big {
    font-size: 8rem;
    margin-bottom: 2rem;
    animation: shake 0.5s infinite;
}

@keyframes shake {
    0% {
        transform: rotate(0deg);
    }

    25% {
        transform: rotate(10deg);
    }

    50% {
        transform: rotate(0deg);
    }

    75% {
        transform: rotate(-10deg);
    }

    100% {
        transform: rotate(0deg);
    }
}

#alarm-stop-btn {
    background: white;
    color: #ef4444;
    font-size: 2rem;
    padding: 1.5rem 4rem;
    border: none;
    border-radius: 5rem;
    cursor: pointer;
    font-weight: 800;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    margin-top: 2rem;
}

/* HTML Preview */
#htmlPreviewContainer {
    display: none;
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 4px;
}

#htmlPreviewIframe {
    width: 100%;
    height: 100%;
    border: none;
}

.view-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border);
    color: var(--text-dim);
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    margin-left: 0.5rem;
}

.view-toggle.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.ringtone-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

/* Theme Toggle */
.theme-toggle {
    margin-left: 1rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-main);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: 0.3s;
}

.theme-toggle:hover {
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary);
}

/* OTP Settings */
.otp-box {
    background: rgba(16, 185, 129, 0.1);
    border: 2px dashed var(--primary);
    padding: 1.5rem;
    border-radius: 1rem;
    text-align: center;
    margin: 1rem 0;
}

.otp-code {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: 0.5rem;
    color: var(--primary);
    font-family: 'Fira Code', monospace;
}

/* Bot Config Editor */
.config-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    align-items: center;
}

.config-row input {
    flex: 1;
}

/* Error Alerts & Suggestions */
.error-alert {
    margin-bottom: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid #ef4444;
    padding: 1rem;
    border-radius: 0.5rem;
    display: none;
    animation: slideDown 0.3s ease-out;
}

.error-alert.show {
    display: block;
}

.error-title {
    color: #ef4444;
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.error-msg {
    color: var(--text-main);
    font-size: 0.85rem;
    font-family: 'Fira Code', monospace;
}

.suggestion-box {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: rgba(16, 185, 129, 0.1);
    border: 1px dashed var(--primary);
    border-radius: 0.4rem;
    font-size: 0.85rem;
    color: var(--primary);
}

.suggestion-box i {
    margin-right: 0.5rem;
}

/* Monaco Marker Styling */
.error-marker {
    background: rgba(239, 68, 68, 0.2);
    border-bottom: 2px wavy #ef4444;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Kanban Board Styles */
.kanban-board {
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    padding: 1rem 0;
    height: 100%;
    min-height: 0;
    align-items: flex-start;
}

.kanban-column {
    min-width: 320px;
    max-width: 320px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: 1rem;
    display: flex;
    flex-direction: column;
    max-height: 100%;
}

.kanban-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 1rem 1rem 0 0;
}

.kanban-header h3 {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-main);
}

.kanban-tasks {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.kanban-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1rem;
    cursor: grab;
    transition: 0.2s;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.kanban-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.kanban-card:active {
    cursor: grabbing;
}

.kanban-card-text {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.kanban-card-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-dim);
}

.kanban-card-badge {
    height: 4px;
    width: 40px;
    border-radius: 2px;
    margin-bottom: 0.75rem;
}

.kanban-add-col {
    min-width: 320px;
    border: 2px dashed var(--border);
    border-radius: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    cursor: pointer;
    color: var(--text-dim);
    transition: 0.2s;
    padding: 2rem;
}

.kanban-add-col:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(16, 185, 129, 0.05);
}
@media (max-width: 768px) {
    .kanban-board {
        padding: 0 1rem 1rem 1rem !important;
        gap: 1rem;
    }
    .kanban-column {
        min-width: 85vw;
        max-width: 85vw;
    }
    .modal {
        padding: 1.5rem;
    }
    .nav-content {
        padding: 0 1rem;
    }
}

/* Integrated Clock Custom Styles */
#integrated-clock {
    letter-spacing: -1px;
    background: linear-gradient(135deg, var(--primary), #ffffff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 10px 20px rgba(16, 185, 129, 0.2);
}

.countdown-timer {
    display: inline-block;
    padding: 2px 6px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 4px;
}

/* Immersive Auth Card */
.auth-card-immersive {
    background: var(--bg-card);
    padding: 3rem;
    border-radius: 2rem;
    border: 1px solid var(--border);
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    animation: authCardIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes authCardIn {
    from { opacity: 0; transform: scale(0.9) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.auth-card-immersive h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.auth-card-immersive .form-group input {
    background: var(--bg-main);
    border: 1px solid var(--border);
    padding: 1rem;
    font-size: 1.1rem;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.auth-card-immersive .form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.1);
}

/* Immersive Auth Overlay Refinement */
.auth-req-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-dark); /* Solid background to hide content */
    z-index: 1000; /* Ensure it's on top */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

#section-todo {
    position: relative;
    overflow: hidden;
}

.auth-card-immersive {
    box-shadow: 0 0 100px rgba(16, 185, 129, 0.1);
}

/* Ping Tester Styles */
.monitor-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1rem;
    transition: 0.2s;
}

.monitor-card:hover {
    border-color: var(--primary);
}

.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.5rem;
}

.status-up { background: #10b981; }
.status-down { background: #ef4444; }
.status-unknown { background: #9ca3af; }

@media (max-width: 768px) {
    #section-ping > div {
        grid-template-columns: 1fr !important;
    }
}

/* Ping Tester Redesigned Layout */
.ping-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    height: 100%;
}

.ping-live-panel {
    display: flex;
    flex-direction: column;
}

.ping-right-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Monitor Card Enhancements */
.monitor-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.monitor-quick-ping {
    flex: 1;
    padding: 0.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: 0.2s;
}

.monitor-quick-ping:hover {
    background: #0d9488;
}

.monitor-toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.monitor-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.monitor-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #9ca3af;
    transition: 0.3s;
    border-radius: 24px;
}

.monitor-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.monitor-toggle input:checked + .monitor-toggle-slider {
    background-color: var(--primary);
}

.monitor-toggle input:checked + .monitor-toggle-slider:before {
    transform: translateX(26px);
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .ping-layout {
        grid-template-columns: 1fr;
    }
    
    .ping-live-panel {
        order: 1;
    }
    
    .ping-right-panel {
        order: 2;
    }
}

@media (max-width: 768px) {
    .ping-layout {
        gap: 1rem;
    }
    
    .monitor-card-actions {
        flex-direction: column;
    }
}
