:root {
    --bg-body: #000000;
    --bg-card: #16181c;
    --bg-hover: #1d1f23;
    --text-primary: #e7e9ea;
    --text-secondary: #71767b;
    --border-color: #2f3336;
    --accent-color: #1d9bf0;
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --sidebar-width: 275px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-body);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 15px;
    line-height: 1.5;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

.layout-container {
    display: flex;
    margin: 0 auto;
    width: 100%;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    position: sticky;
    top: 0;
    border-right: 1px solid var(--border-color);
    padding: 12px;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 12px;
    margin-bottom: 12px;
}

.sidebar-header-main {
    padding: 12px;
    margin-bottom: 12px;
}

.user-profile {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 50px;
    transition: background-color 0.2s;
}

.user-profile:hover {
    background-color: var(--bg-hover);
}

.avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    margin-right: 12px;
    border: solid;
    border-color: var(--accent-color);
}

.user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.username {
    font-weight: 700;
    font-size: 16px;
}

.handle {
    color: var(--text-secondary);
    font-size: 14px;
}

.search-container {
    padding: 0 12px 12px 12px;
}

.search-input {
    width: 100%;
    background-color: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    padding: 10px 16px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: var(--accent-color);
}

.settings-nav ul {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-radius: 9999px;
    font-size: 17px;
    font-weight: bold;
    transition: background-color 0.2s;
    color: var(--text-primary);
}

.nav-link:hover {
    background-color: var(--bg-hover);
}

.nav-link.active-link {
    background-color: var(--bg-hover);
}

.nav-svg {
    display: inline-block;
    width: 1.3em;
    height: 1.3em;
    vertical-align: middle;
    margin-right: 16px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.item-svg {
    display: inline-block;
    width: 1.3em;
    height: 1.3em;
    vertical-align: middle;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar-footer {
    margin-top: auto;
    padding: 12px;
    border-top: 1px solid var(--border-color);
}

.btn-logout {
    width: 100%;
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px;
    border-radius: 9999px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-logout:hover {
    background-color: var(--bg-hover);
    color: var(--accent-color);
    border-color: var(--accent-color);
}

.mobile-header {
    display: none;
    position: sticky;
    top: 0;
    background-color: var(--theme-bg-tertiary);
    backdrop-filter: blur(12px);
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 16px;
}

.mobile-header-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.back-icon {
    width: 24px;
    height: 24px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mobile-header-top h1 {
    font-size: 20px;
    font-weight: 700;
}

.main-content {
    flex: 1;
    padding: 0;
    margin: 0 auto;
    border-right: 1px solid var(--border-color);
    width: 100%;
    min-height: 100vh;
}

.empty-state {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: var(--text-secondary);
    font-size: 18px;
    padding: 20px;
    text-align: center;
}

.content-body {
    padding: 20px;
}

.settings-section {
    margin-bottom: 32px;
    scroll-margin-top: 160px;
}

.settings-section h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    padding-bottom: 12px;
    padding-top: 12px;
    border-bottom: 1px solid var(--border-color);
}

.settings-section h3 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.card {
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item:hover {
    background-color: var(--bg-hover);
}

.list-content {
    text-decoration: none;
    color: inherit;
    flex-grow: 1;
    padding-right: 16px;
}

.text-wrapper {
    display: flex;
    flex-direction: column;
}

.item-title {
    display: block;
    font-weight: 600;
    margin-bottom: 4px;
    margin-left: 10px;
    margin-right: 10px;
    color: var(--text-primary);
}

.item-desc {
    color: var(--text-secondary);
    font-size: 14px;
    margin-left: 10px;
}

.chevron-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: color 0.2s;
    width: 24px;
    height: 24px;
}

.chevron-icon:hover {
    color: var(--text-primary);
}

.chevron-icon svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.card.profile-banner {
    margin-bottom: 0;
    border-bottom: none;
}

.banner-container {
    position: relative;
    box-sizing: border-box;
    width: 100%;
    height: 150px;
    overflow: hidden;
    border: 1px solid var(--accent-color);
    border-radius: 30px;
    margin: 16px;
    margin-right: 20px;
    margin-left: 0px;
    cursor: pointer;
}

.banner-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: filter 0.2s;
}

.banner-container:hover .banner-image {
    filter: brightness(0.7);
}

.btn-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: white;
    padding: 8px 16px;
    border-radius: 9999px;
    font-weight: 700;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.banner-container:hover .btn-overlay {
    opacity: 1;
}

.card.profile-info {
    padding-top: 16px;
}

.avatar-container {
    position: relative;
    width: 100px;
    height: 100px;
    margin-bottom: 16px;
    cursor: pointer;
}

.avatar-large {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid var(--accent-color);
    object-fit: cover;
    transition: filter 0.2s;
}

.avatar-container:hover .avatar-large {
    filter: brightness(0.7);
}

.btn-overlay-avatar {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: white;
    padding: 4px 8px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.avatar-container:hover .btn-overlay-avatar {
    opacity: 1;
}

.form-group input,
.form-group textarea {
    width: 100%;
    resize: none;
    background-color: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 16px;
    font-family: var(--font-family);
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-color);
}

.input-disabled {
    background-color: var(--bg-hover);
    color: var(--text-secondary);
    cursor: not-allowed;
}

.btn-primary {
    background-color: var(--text-primary);
    color: var(--bg-body);
    border: none;
    border-radius: 9999px;
    padding: 10px 20px;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    margin-top: 8px;
}

.btn-primary:hover {
    opacity: 0.9;
}

.card.danger-zone {
    border: 1px solid rgba(249, 24, 128, 0.3);
    background-color: rgba(249, 24, 128, 0.05);
    padding: 20px;
    border-radius: 12px;
}

.card.danger-zone h3 {
    color: #f91880;
}

.btn-danger {
    background-color: transparent;
    color: #f91880;
    border: 1px solid #f91880;
    border-radius: 9999px;
    padding: 10px 20px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: auto;
    margin-top: 0;
}

.btn-danger:hover {
    background-color: #f91880;
    color: #000000;
}

.helper-text {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.privacy-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.privacy-row:last-child {
    border-bottom: none;
}

.custom-select {
    appearance: none;
    background-color: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px 8px 12px;
    font-size: 14px;
    font-family: var(--font-family);
    cursor: pointer;
    min-width: 160px;
    text-align: right;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2371767b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left 10px center;
    background-size: 16px;
    transition: border-color 0.2s;
}

.custom-select:hover {
    border-color: var(--text-secondary);
}

.custom-select:focus {
    outline: none;
    border-color: var(--accent-color);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-hover);
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-color);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--accent-color);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

.audio-control-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.audio-control-wrapper:last-child {
    border-bottom: none;
}

.play-icon {
    width: 24px;
    height: 24px;
    fill: var(--accent-color);
    cursor: pointer;
    transition: transform 0.2s;
}

.play-icon:hover {
    transform: scale(1.1);
}

.limit-control {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 10px 0px 15px 0px;
}

.time-input-group {
    display: flex;
    align-items: center;
    background-color: var(--bg-hover);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    color: var(--text-primary);
    font-weight: bold;
    font-size: 16px;
}

.time-input-group input {
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 16px;
    font-weight: bold;
    width: 50px;
    text-align: center;
    padding: 0;
}

.time-input-group input:focus {
    outline: none;
}

.time-separator {
    margin: 0 4px;
    color: var(--text-secondary);
}

.chart-container {
    position: relative;
    width: 100%;
    height: 200px;
    margin-top: 16px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

.chart-lines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.chart-line {
    width: 100%;
    height: 1px;
    background-color: var(--border-color);
    opacity: 0.3;
}

.chart-bar-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    justify-content: flex-end;
    position: relative;
    margin: 0 4px;
}

.chart-bar {
    width: 100%;
    max-width: 40px;
    border-radius: 6px 6px 0 0;
    transition: height 0.5s ease;
    position: relative;
    cursor: pointer;
}

.chart-bar:hover::after {
    content: attr(data-hours) "h";
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-hover);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    z-index: 10;
}

.chart-label {
    position: absolute;
    bottom: -25px;
    font-size: 12px;
    color: var(--text-secondary);
}

.bar-low {
    background-color: var(--text-secondary);
    opacity: 0.6;
}

.bar-normal {
    background-color: var(--accent-color);
}

.bar-high {
    background-color: #f91880;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
}

.stat-card {
    background-color: var(--bg-card);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-highlight {
    color: var(--accent-color);
}

.back-btn {
    display: none;
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 90;
        background-color: var(--bg-body);
        border-right: none;
    }

    .sidebar.mobile-hidden {
        display: none !important;
    }

    .sidebar.mobile-hidden ~ .main-content .mobile-header {
        display: block;
    }

    .mobile-header {
        display: block;
    }

    .sidebar-header {
        padding: 16px;
        display: flex;
        justify-content: center;
        border-bottom: 1px solid var(--border-color);
        position: sticky;
    }

    .sidebar-header-main {
        padding: 16px;
        display: flex;
        justify-content: space-between;
        border-bottom: 1px solid var(--border-color);
        position: sticky;
    }

    .user-info {
        display: none;
    }

    .user-profile {
        padding: 0;
        border-radius: 50%;
    }

    .back-btn {
        display: inline-block !important;
        vertical-align: middle;
        justify-content: center;
        font-size: 20px;
        align-items: center;
        gap: 8px;
        color: var(--text-primary);
    }

    .avatar {
        width: 40px;
        height: 40px;
        margin-right: 0;
        border-width: 2px;
    }

    .search-container {
        display: block;
    }

    .nav-link {
        border-bottom: 1px solid var(--border-color);
        border-radius: 0;
    }

    .nav-link:last-child {
        border-bottom: none;
    }

    .nav-link:hover {
        background-color: var(--bg-hover);
    }

    .main-content {
        width: 100%;
        border-right: none;
    }

    .sidebar:not(.mobile-hidden) ~ .main-content {
        display: none;
    }

    .sidebar.mobile-hidden ~ .main-content {
        display: block;
    }

    .nav-item {
        border-bottom: 1px solid var(--border-color);
    }

    .chart-container {
        height: 150px;
    }

    .chart-bar {
        max-width: 20px;
    }
}

.username-input-wrapper {
    position: relative;
}

.input-username {
    padding-right: 40px; /* Space for the lock icon */
}

.lock-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    opacity: 0.5;
    pointer-events: none;
}

.helper-text {
    display: block;
    margin-top: 4px;
    font-size: 0.85rem;
    color: #888;
}

.text-muted {
    color: #666;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.modal-container {
    background: #000000;
    border-radius: 12px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.1rem;
    color: #ffffff;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #000000;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Form Elements inside Modal */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: #ffffff;
}

.input-field {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box;
}

.input-field:focus {
    outline: none;
    border-color: #007bff;
}

.btn-secondary {
    background: #ff0000;
    color: #ffffff;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-secondary:hover {
    background: #7c0000;
}

.btn-text {
    background: none;
    border: none;
    color: #007bff;
    cursor: pointer;
    font-size: 0.9rem;
    text-decoration: underline;
    margin-right: auto;
}

/* Toast Notifications */
.toast-success, .toast-error {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    font-weight: bold;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

.toast-success {
    background: #28a745;
}

.toast-error {
    background: #dc3545;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}