﻿:root {
    --bg-color: #0f0f13;
    --text-color: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --primary-color: #6c5ce7;
    --accent-color: #a29bfe;
    --font-family: 'Outfit', sans-serif;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

#space {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.circle {
    box-sizing: border-box;
    position: absolute;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 10px;
    cursor: pointer;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
    transition: box-shadow 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    will-change: transform;
    top: 0;
    left: 0;
    transform: translate3d(var(--x, 0), var(--y, 0), 0);
}

.circle:hover {
    transform: translate3d(var(--x, 0), var(--y, 0), 0) scale(1.05);
    z-index: 100;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.2);
}

.circle .content {
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.2;
}

.circle .name {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.circle .days {
    font-size: 0.85em;
    opacity: 0.85;
}

/* Tooltip */
.circle .tooltip {
    position: absolute;
    bottom: 110%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.8rem;
    white-space: pre-wrap;
    width: max-content;
    max-width: 200px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 200;
    border: 1px solid var(--glass-border);
}

.circle:hover .tooltip {
    opacity: 1;
}

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
}

.modal.hidden {
    display: none;
}

.glass {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    max-width: 500px;
    width: 90%;
}

h2 {
    margin-top: 0;
    font-weight: 300;
    letter-spacing: 1px;
}

textarea {
    width: 100%;
    height: 150px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    padding: 10px;
    font-family: monospace;
    margin: 1rem 0;
    resize: vertical;
}

.form-group {
    margin-bottom: 1rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9em;
    opacity: 0.8;
}

input,
select {
    width: 100%;
    padding: 0.8rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    font-family: var(--font-family);
}

button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-family);
    font-weight: 500;
    transition: background 0.2s;
}

button:hover {
    background: var(--accent-color);
}

button.secondary {
    background: transparent;
    border: 1px solid var(--glass-border);
}

button.secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.is-hidden {
    display: none !important;
}

.start-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9em;
    opacity: 0.85;
    margin-bottom: 6px;
    user-select: none;
}

.start-toggle input {
    appearance: none;
    width: 22px;
    height: 22px;
    border: 1px solid var(--glass-border);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    position: relative;
    cursor: pointer;
    transition: border 0.2s, background 0.2s;
}

.start-toggle input::after {
    content: '';
    position: absolute;
    width: 7px;
    height: 12px;
    border: solid transparent;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    opacity: 0;
}

.start-toggle input:checked {
    border-color: var(--primary-color);
    background: var(--primary-color);
}

.start-toggle input:checked::after {
    left: 8px;
    top: 4px;
    border-color: #fff;
    opacity: 1;
}

.start-date-wrapper.hidden {
    display: none;
}

.edit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 12px;
}

.edit-header h2 {
    margin: 0;
}

.start-toggle-inline {
    margin: 0;
    gap: 0;
    align-self: flex-start;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.days-dual {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.days-dual .days-cell {
    flex: 0 0 auto;
    text-align: left;
}

.waiting-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.text-btn {
    background: transparent;
    border: none;
    color: var(--accent-color);
    padding: 0;
    font-size: 0.9em;
    cursor: pointer;
}

.text-btn:hover {
    opacity: 0.8;
}

.waiting-info {
    font-size: 0.85em;
    opacity: 0.75;
}

.waiting-label {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: 8px;
    background: rgb(250, 200, 1);
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.waiting-badge {
    margin-left: 6px;
    padding: 2px 6px;
    border-radius: 8px;
    background: rgba(255, 205, 3, 0.964);
    font-size: 0.65em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #000;
}

.completed-tooltip {
    position: absolute;
    background: rgba(13, 13, 18, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 1rem;
    width: 280px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
    color: white;
    z-index: 3000;
}

.completed-tooltip h4 {
    margin: 0 0 0.5rem 0;
}

.completed-tooltip p {
    margin: 0.3rem 0;
    font-size: 0.9em;
}

.completed-tooltip .tooltip-close {
    margin-top: 0.8rem;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
}

.completed-tooltip .tooltip-close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.ended-actions {
    justify-content: space-between;
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-group {
    flex: 1;
}

button.danger {
    background: #ff7675;
}

button.danger:hover {
    background: #d63031;
}

.actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Icon Button */
.icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    padding: 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
    color: white;
}

.icon-btn img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    pointer-events: none;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.icon-btn-group {
    position: fixed;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 12px;
    z-index: 500;
}

.icon-btn--export {
    display: var(--export-button-display, flex);
}

.icon-btn--subs {
    display: var(--subscriptions-button-display, flex);
}

/* Large Modal for Table */
.modal-content.large {
    max-width: 900px;
    width: 95%;
    height: 80vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    color: white;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.table-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 18px;
}

.subs-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 1rem;
}

.summary-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 12px;
}

.summary-card .label {
    display: block;
    font-size: 0.75rem;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.summary-card strong {
    font-size: 1.4rem;
}

.summary-card--net {
    background: rgba(108, 92, 231, 0.15);
    border-color: rgba(108, 92, 231, 0.3);
}

.summary-card--net strong {
    color: #2ecc71;
}

.summary-card--net strong.negative {
    color: #ff7675;
}

.subs-table table {
    width: 100%;
    border-collapse: collapse;
}

.subs-table th,
.subs-table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.subs-table tbody tr.cancelled {
    opacity: 0.4;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.1);
}

.status-pill.active {
    background: rgba(46, 213, 115, 0.2);
}

.status-pill.cancelled {
    background: rgba(255, 99, 72, 0.3);
}

.status-pill.income {
    background: rgba(0, 251, 105, 0.664);
}

.status-pill.expense {
    background: rgba(236, 34, 34, 0.73);
}

.link-btn {
    background: none;
    border: none;
    color: var(--accent-color);
    cursor: pointer;
    padding: 0;
    font: inherit;
    text-align: left;
}

.link-btn:hover {
    text-decoration: underline;
    background: none;
}

/* Subscriptions table: не подсвечиваем название как ссылку */
.subs-table .subs-name-link {
    color: var(--accent-color);
}

.subs-table .subs-name-link:hover {
    text-decoration: none;
    background: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.subs-editor {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.subs-editor .form-row {
    flex-wrap: wrap;
}

.subs-editor .form-row .form-group {
    flex: 1 1 220px;
}

.subs-editor input,
.subs-editor select {
    box-sizing: border-box;
}

#subs-date {
    max-width: 180px;
}

/* Кастомные цвета выпадающих Type/Status */
#subs-type option,
#subs-status option {
    background: #15151f;
    color: #ffffff;
}

#subs-type option:checked,
#subs-status option:checked {
    background: #6c5ce7;
    color: #ffffff;
}

.subs-editor.hidden {
    display: none;
}

.subs-editor h3 {
    margin-top: 0;
    margin-bottom: 0.75rem;
}

/* Custom Scrollbar Styling */
.table-container::-webkit-scrollbar {
    width: 8px;
}

.table-container::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.table-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Firefox scrollbar */
.table-container {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) rgba(255, 255, 255, 0.05);
}

table {
    width: 100%;
    border-collapse: collapse;
    color: white;
}

th,
td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

th {
    font-weight: 500;
    opacity: 0.7;
    position: sticky;
    top: 0;
    background: #1a1a20;
    z-index: 10;
}

/* Priority Colors in Table */
.priority-cell {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    display: inline-block;
    color: #000;
    font-weight: 500;
    cursor: pointer;
    position: relative;
}

.priority-cell:hover {
    opacity: 0.8;
}

.date-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.date-hint {
    font-size: 0.75rem;
    opacity: 0.65;
}

.priority-Normal {
    background: #ffeaa7;
}

.priority-High {
    background: #ff7675;
}

.priority-Critical {
    background: #fd79a8;
}

.priority-Low {
    background: #55efc4;
}

/* Days Left Colors */
.days-cell {
    padding: 4px 8px;
    border-radius: 4px;
    color: #000;
    font-weight: 500;
    display: inline-block;
    width: 100%;
    text-align: center;
}

.days-urgent {
    background: #ff7675;
}

.days-soon {
    background: #ffeaa7;
}


.days-safe {
    background: #81ecec;
}

.days-display {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-width: 90px;
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
}

.completed-section {
    margin-top: 2rem;
}

.completed-section h3 {
    margin-bottom: 0.5rem;
    font-weight: 500;
    opacity: 0.8;
}

.empty-cell {
    text-align: center;
    opacity: 0.6;
    font-style: italic;
}

/* Notes Modal */
.notes-modal {
    max-width: 1100px;
    width: 92%;
    max-height: 85vh;
}

.notes-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.notes-tab {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 999px;
    padding: 6px 14px;
    color: white;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 0.9rem;
    transition: background 0.2s, border 0.2s;
}

.notes-tab:hover {
    background: rgba(255, 255, 255, 0.18);
}

.notes-tab.is-active {
    background: rgba(108, 92, 231, 0.35);
    border-color: rgba(108, 92, 231, 0.8);
}

.notes-tab-add {
    background: rgba(108, 92, 231, 0.2);
    border-color: rgba(108, 92, 231, 0.5);
    font-weight: 600;
    font-size: 1.1rem;
    min-width: 36px;
    padding: 4px 10px;
}

.notes-tab-add:hover {
    background: rgba(108, 92, 231, 0.4);
    border-color: rgba(108, 92, 231, 0.8);
}

.icon-btn--export:hover {
    background: rgba(46, 204, 113, 0.2);
    border-color: rgba(46, 204, 113, 0.6);
}

.icon-btn--import:hover {
    background: rgba(255, 159, 67, 0.2);
    border-color: rgba(255, 159, 67, 0.6);
}

.notes-tab-edit-input {
    font-family: var(--font-family);
    font-size: 0.9rem;
}

.notes-body {
    margin-top: 16px;
}

.notes-editor-contenteditable {
    min-height: 400px;
    max-height: 60vh;
    overflow-y: auto;
    font-family: var(--font-family);
    font-size: 0.95rem;
    background: rgba(0, 0, 0, 0.25);
    width: 100%;
    box-sizing: border-box;
    line-height: 1.6;
    color: rgba(255, 255, 255, 0.9);
    border: 1px dashed rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 14px;
    white-space: pre-wrap;
    word-break: break-word;
    outline: none;
}

.notes-editor-contenteditable:empty:before {
    content: attr(data-placeholder);
    color: rgba(255, 255, 255, 0.4);
    pointer-events: none;
}

.notes-editor-contenteditable a {
    color: #74b9ff;
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s;
}

.notes-editor-contenteditable a:hover {
    color: #a29bfe;
}

.notes-editor-contenteditable::-webkit-scrollbar {
    width: 6px;
}

.notes-editor-contenteditable::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.notes-editor-contenteditable::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

.notes-editor-contenteditable::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.notes-hint {
    margin-top: 14px;
    font-size: 0.85rem;
    opacity: 0.7;
    text-align: center;
}