* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Dark mode (default) */
    --bg-primary: #0f0f23;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16213e;
    --text-primary: #e4e4e7;
    --text-secondary: #a1a1aa;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --border: #27272a;
    --card-bg: rgba(26, 26, 46, 0.8);
    --shadow: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] {
    /* Light mode */
    --bg-primary: #f5f5f7;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0f0f0;
    --text-primary: #1d1d1f;
    --text-secondary: #6e6e73;
    --accent: #0071e3;
    --accent-hover: #0077ed;
    --border: #d2d2d7;
    --card-bg: rgba(255, 255, 255, 0.9);
    --shadow: rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
    transition: background-color 0.3s ease, color 0.3s ease;
}

[data-theme="light"] body {
    background-image: 
        radial-gradient(circle at 20% 50%, rgba(0, 113, 227, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(139, 92, 246, 0.05) 0%, transparent 50%);
}

.container {
    width: 100%;
    max-width: 1200px;
    animation: fadeIn 0.5s ease-in;
}

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

header {
    text-align: center;
    margin-bottom: 40px;
    position: relative;
}

.header-top {
    display: grid;
    grid-template-columns: 250px 1fr 250px;
    align-items: center;
    gap: 30px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    z-index: 1;
}

.header-top .user-info {
    grid-column: 1;
}

.header-top .notes-widget {
    grid-column: 2;
    justify-self: center;
    width: 300px;
    max-width: 300px;
}

.header-top .theme-toggle-container {
    grid-column: 3;
    justify-self: end;
}

/* Center time display by using grid with equal spacing */
.header-content {
    display: grid;
    grid-template-columns: 250px 1fr 300px;
    grid-template-rows: 1fr;
    align-items: stretch;
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.header-content .weather-widget.compact {
    grid-column: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.header-content .time-display {
    grid-column: 2;
    justify-self: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 300px;
    max-width: 300px;
}

/* Create a container for Finance and Plex widgets to stack them */
/* Right widgets container to stack Finance and Plex */
.right-widgets-container {
    grid-column: 3;
    grid-row: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 100%;
    min-height: 0;
}

.header-content .t212-widget {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    min-width: 300px;
    max-width: 300px;
    width: 100%;
}

.header-content .t212-widget:not(.collapsed) {
    flex: 1;
    min-height: 0;
}

.header-content .t212-widget.collapsed {
    height: auto !important;
    max-height: fit-content;
    flex: 0 0 auto;
}

.header-content .plex-widget {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    min-width: 300px;
    max-width: 300px;
    width: 100%;
}

.header-content .plex-widget:not(.collapsed) {
    flex: 1;
    min-height: 0;
}

.header-content .plex-widget.collapsed {
    height: auto !important;
    max-height: fit-content;
    flex: 0 0 auto;
    align-self: flex-start;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-details {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--card-bg);
    padding: 8px 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    padding: 0;
}

.btn-icon:hover {
    background: var(--bg-tertiary);
    color: var(--accent);
}

.user-email {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.logout-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: var(--border);
    border-color: var(--accent);
}

.theme-toggle-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 10;
}

/* Trading212 Widget */
.t212-widget {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    padding-bottom: 0;
    min-width: 250px;
    max-width: 250px;
    position: relative;
    display: flex;
    flex-direction: column;
}

.t212-widget.collapsed {
    padding: 4px 8px;
    padding-bottom: 4px;
    height: auto !important;
    min-height: auto !important;
    max-height: fit-content;
    flex-direction: row;
    align-items: center;
    overflow: hidden;
}

.t212-widget.collapsed .t212-content {
    display: none;
}

.t212-widget.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.t212-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    width: 100%;
}

.t212-widget.collapsed .t212-header {
    margin-bottom: 0;
    line-height: 1.2;
    display: flex;
    align-items: center;
    height: auto;
    min-height: auto;
}

.t212-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.t212-widget.collapsed .t212-title {
    font-size: 0.75rem;
}

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

.t212-content {
    padding-bottom: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.t212-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.t212-loading,
.t212-error {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    padding: 8px 0;
}

.t212-error {
    color: var(--error);
}

.t212-data {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.t212-balance,
.t212-equity,
.t212-pl {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
}

.t212-label {
    color: var(--text-secondary);
    font-weight: 500;
}

.t212-value {
    color: var(--text-primary);
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

/* Plex Widget */
.plex-widget {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    padding-bottom: 0;
    min-width: 250px;
    max-width: 250px;
    position: relative;
    display: flex;
    flex-direction: column;
}

.plex-widget.collapsed {
    padding: 4px 8px;
    padding-bottom: 4px;
    height: auto !important;
    min-height: auto !important;
    max-height: fit-content;
    flex-direction: column;
    align-items: stretch;
    overflow: hidden;
    min-width: 300px;
    max-width: 300px;
}

.plex-widget.collapsed .plex-content {
    display: none;
}

.plex-widget.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.plex-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    width: 100%;
}

.plex-widget.collapsed .plex-header {
    margin-bottom: 0;
    line-height: 1.2;
    display: flex;
    align-items: center;
    height: auto;
    min-height: auto;
}

.plex-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.plex-widget.collapsed .plex-title {
    font-size: 0.75rem;
}

.plex-widget.has-error .plex-header {
    border-left: 3px solid #ef4444;
    padding-left: 5px;
}

.plex-widget.has-error.collapsed .plex-title::after {
    content: " ⚠️";
    color: #ef4444;
    font-size: 0.7rem;
    margin-left: 4px;
}

.plex-widget.has-error.collapsed .plex-content {
    display: none !important;
}

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

.plex-content {
    padding-bottom: 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.plex-loading,
.plex-error {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    padding: 8px 0;
}

.plex-error {
    color: var(--error);
}

.plex-data {
    display: block;
    flex: 1;
    min-height: 0;
    overflow: auto;
    margin: 0;
    padding: 0;
}

.plex-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    table-layout: auto;
    margin: 0;
    padding: 0;
}

.plex-table thead {
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--card-bg);
}

.plex-table th {
    text-align: center;
    padding: 8px 10px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-left: 10px !important;
    padding-right: 10px !important;
    margin: 0;
    text-indent: 0;
}

.plex-table th:nth-child(1) {
    width: auto;
    min-width: 120px;
}

.plex-table th:nth-child(2) {
    width: auto;
}

.plex-table td {
    padding: 12px 10px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    word-break: break-word;
    overflow-wrap: break-word;
    padding-left: 10px !important;
    padding-right: 10px !important;
    margin: 0;
    text-indent: 0;
}

.plex-table td:first-child {
    min-width: 120px;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    position: relative;
    display: table-cell;
}

.plex-table td:last-child {
    overflow: visible;
    word-wrap: break-word;
    white-space: normal;
    position: relative;
    display: table-cell;
}

.plex-table tbody tr:last-child td {
    border-bottom: none;
}

.plex-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.plex-user-cell {
    display: table-cell;
    vertical-align: middle;
    padding-left: 0 !important;
    margin-left: 0 !important;
}

.plex-user-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-tertiary);
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.plex-user-name {
    color: var(--text-primary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.plex-media-cell {
    display: table-cell;
    vertical-align: top;
    padding-left: 0 !important;
    margin-left: 0 !important;
}

.plex-media-cell > * {
    display: inline-block;
    vertical-align: top;
    margin-right: 8px;
}

.plex-media-cell > *:last-child {
    margin-right: 0;
}

.plex-media-icon {
    width: 16px;
    height: 16px;
    opacity: 0.8;
    flex-shrink: 0;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.plex-media-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
    overflow: visible;
    word-wrap: break-word;
    max-width: 100%;
}

.plex-media-title {
    color: var(--text-primary);
    font-weight: 500;
    white-space: normal;
    line-height: 1.3;
    word-wrap: break-word;
    font-size: 0.7rem;
}

.plex-media-show {
    color: var(--text-secondary);
    font-size: 0.65rem;
    white-space: normal;
    line-height: 1.2;
    word-wrap: break-word;
}

.theme-toggle {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-primary);
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.theme-toggle:hover {
    background: var(--bg-tertiary);
    border-color: var(--accent);
    transform: scale(1.05);
}

.theme-icon {
    position: absolute;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.sun-icon {
    opacity: 0;
    transform: rotate(90deg);
}

.moon-icon {
    opacity: 1;
    transform: rotate(0deg);
}

[data-theme="light"] .sun-icon {
    opacity: 1;
    transform: rotate(0deg);
}

[data-theme="light"] .moon-icon {
    opacity: 0;
    transform: rotate(-90deg);
}

/* Make theme toggle darker in dark mode */
.theme-toggle {
    background: var(--bg-tertiary);
}

[data-theme="light"] .theme-toggle {
    background: var(--card-bg);
}

/* Quick Notes Widget */
.header-top .notes-widget {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px;
    padding-bottom: 0;
    min-width: 180px;
    max-width: 250px;
    width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    flex: 1;
    margin: 0;
}

.header-top .notes-widget .notes-header {
    margin-bottom: 6px;
}

.header-top .notes-widget .notes-title {
    font-size: 0.75rem;
}

.header-top .notes-widget .notes-content {
    padding-bottom: 8px;
}

.notes-widget {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    padding-bottom: 0;
    min-width: 250px;
    max-width: 400px;
    width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    margin: 20px auto;
}

.notes-widget.collapsed .notes-content {
    display: none;
}

.notes-widget.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.notes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.notes-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

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

.notes-content {
    padding-bottom: 12px;
}

.notes-footer {
    margin-top: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.notes-preview {
    padding: 8px;
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Full-Width Notes Modal */
.notes-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.notes-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.notes-modal-content {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 95%;
    max-width: 1400px;
    height: 90vh;
    max-height: 900px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.notes-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.notes-modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
}

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

.notes-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.notes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.note-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    min-height: 150px;
}

.note-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.note-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 12px;
}

.note-card-title {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
}

.note-card-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
    white-space: nowrap;
    margin-left: 12px;
}

.note-card-content {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}

/* Note Edit Modal */
.note-edit-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1001;
    backdrop-filter: blur(4px);
}

.note-edit-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.note-edit-content {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.note-edit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.note-edit-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.note-edit-body {
    padding: 24px;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.note-title-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    font-family: inherit;
}

.note-content-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    min-height: 400px;
}

.note-edit-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    gap: 12px;
}

.note-edit-footer > div {
    display: flex;
    gap: 12px;
}

.auth-prompt {
    margin-top: 20px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.auth-prompt p {
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.btn-primary {
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.time-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    justify-content: center;
}

.time {
    font-size: 4rem;
    font-weight: 300;
    letter-spacing: -2px;
    color: var(--text-primary);
}

.date {
    font-size: 1.2rem;
    color: var(--text-secondary);
    font-weight: 400;
}

/* Fixture Widget */
.fixture-widget {
    margin-top: 20px;
    padding: 15px 20px;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
    min-width: 0;
    max-width: 100%;
    width: 100%;
    position: relative;
    box-sizing: border-box;
    overflow: hidden;
}

.fixture-loading,
.fixture-error {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
    padding: 10px;
}

.fixture-error {
    color: #ef4444;
}

.fixture-data {
    text-align: center;
}

.fixture-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    font-weight: 600;
}

.fixture-teams {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
    width: 100%;
    box-sizing: border-box;
}

.fixture-team-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 0;
    flex: 1 1 auto;
    max-width: calc(50% - 20px);
    justify-content: center;
    box-sizing: border-box;
}

.fixture-team {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    max-width: 100%;
    text-align: center;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    word-break: break-word;
    hyphens: auto;
}

.fixture-badge {
    width: 48px;
    height: 48px;
    object-fit: contain;
    display: block;
    flex-shrink: 0;
    max-width: 100%;
}

.fixture-team.home-team {
    color: var(--accent);
}

.fixture-vs {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.fixture-score-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin: 0 4px;
    flex-shrink: 0;
}

.fixture-score {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.fixture-score-home,
.fixture-score-away {
    min-width: 20px;
    text-align: center;
}

.fixture-score-separator {
    margin: 0 2px;
}

.fixture-minute {
    font-size: 0.7rem;
    color: var(--accent);
    font-weight: 600;
    margin-top: 2px;
}

.fixture-date,
.fixture-time {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 6px;
}

.fixture-time {
    font-weight: 600;
    color: var(--text-primary);
}

/* Weather Widget */
.weather-widget {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 8px 32px var(--shadow);
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

.weather-widget.compact {
    padding: 12px 16px;
    margin-bottom: 0;
    width: auto;
    max-width: 250px;
    min-width: 250px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.widget-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.weather-widget.compact .widget-header {
    margin-bottom: 10px;
}

.weather-widget.compact .widget-header h3 {
    font-size: 0.9rem;
    margin: 0;
}

.weather-widget.compact .widget-actions {
    gap: 4px;
}

.weather-widget.compact .widget-btn {
    width: 24px;
    height: 24px;
}

.widget-actions {
    display: flex;
    gap: 8px;
}

.widget-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.widget-btn:hover {
    background: var(--border);
    border-color: var(--accent);
}

.refresh-btn:active {
    transform: rotate(180deg);
}

.widget-content {
    min-height: 100px;
}

.weather-widget.compact .widget-content {
    min-height: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.weather-loading {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
}

.weather-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.weather-data {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.weather-main {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.weather-widget.compact .weather-main {
    padding: 10px;
    gap: 10px;
    flex-direction: row;
    align-items: center;
}

.weather-icon {
    font-size: 4rem;
    line-height: 1;
}

.weather-widget.compact .weather-icon {
    font-size: 2.5rem;
}

.weather-temp {
    font-size: 3rem;
    font-weight: 300;
    color: var(--text-primary);
    line-height: 1;
}

.weather-widget.compact .weather-temp {
    font-size: 2rem;
}

.weather-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    text-transform: capitalize;
    margin-left: auto;
}

.weather-widget.compact .weather-description {
    font-size: 0.75rem;
    margin-left: 0;
    margin-top: 2px;
}

.weather-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.weather-widget.compact .weather-details {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 10px;
}

.weather-detail {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 15px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.weather-widget.compact .weather-detail {
    padding: 8px 10px;
    gap: 4px;
}

.detail-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.detail-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
}

.weather-widget.compact .detail-label {
    font-size: 0.75rem;
}

.weather-widget.compact .detail-value {
    font-size: 0.95rem;
}

.modal-warning {
    background: rgba(251, 191, 36, 0.1);
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: #fbbf24;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    line-height: 1.5;
}

.modal-warning strong {
    color: #f59e0b;
}

.form-help {
    display: block;
    margin-top: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.3);
    border-color: rgba(239, 68, 68, 0.5);
}

.form-label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem;
}

input[type="file"] {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 0.9rem;
    cursor: pointer;
}

.user-item {
    transition: background 0.2s;
}

.user-item:hover {
    background: var(--bg-tertiary);
}

.modal-body {
    padding: 20px;
}

.modal-body p {
    margin-bottom: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.search-section {
    margin-bottom: 50px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
}

.search-form {
    display: flex;
    max-width: 600px;
    margin: 0 auto;
    background: var(--card-bg);
    border-radius: 16px;
    padding: 4px;
    box-shadow: 0 8px 32px var(--shadow);
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
}

.search-form:focus-within {
    border-color: var(--accent);
    box-shadow: 0 8px 32px rgba(59, 130, 246, 0.2);
}

#searchInput {
    flex: 1;
    background: transparent;
    border: none;
    padding: 16px 20px;
    font-size: 1rem;
    color: var(--text-primary);
    outline: none;
}

#searchInput::placeholder {
    color: var(--text-secondary);
}

.search-results {
    max-width: 1200px;
    margin: 30px auto;
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px var(--shadow);
    overflow: hidden;
}

.search-results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-tertiary);
}

.search-results-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--text-primary);
}

.close-results-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-results-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.search-results-content {
    padding: 20px 24px;
    max-height: 600px;
    overflow-y: auto;
}

.search-results-footer {
    display: flex;
    justify-content: center;
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-tertiary);
}

.search-results-footer .btn {
    min-width: 200px;
}

.search-loading,
.search-error {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.search-error {
    color: #ef4444;
}

.search-result-item {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.search-result-item:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.result-link {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.2s;
}

.result-link:hover {
    transform: translateX(4px);
}

.result-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--accent);
    margin: 0 0 6px 0;
    line-height: 1.4;
}

.result-link:hover .result-title {
    text-decoration: underline;
}

.result-url {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    word-break: break-all;
}

.result-snippet {
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.6;
    margin: 0;
}

.search-btn {
    background: var(--accent);
    border: none;
    padding: 12px 20px;
    border-radius: 12px;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.search-btn:hover {
    background: var(--accent-hover);
}

.sections-container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.links-section {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 10px 12px;
    box-shadow: 0 2px 8px var(--shadow);
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
    width: 100%;
    cursor: move;
    transition: all 0.2s;
}

.links-section.dragging {
    opacity: 0.5;
    transform: scale(0.98);
}

.links-section.drag-over {
    border-color: var(--accent);
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
}

.links-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 8px;
}

.section-drag-handle {
    color: var(--text-secondary);
    cursor: grab;
    display: flex;
    align-items: center;
    padding: 2px;
    transition: color 0.2s;
    flex-shrink: 0;
}

.section-drag-handle svg {
    width: 12px;
    height: 12px;
}

.section-drag-handle:active {
    cursor: grabbing;
}

.section-drag-handle:hover {
    color: var(--accent);
}

.links-section h2 {
    flex: 1;
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
}

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

.section-collapse-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.2s;
    width: 22px;
    height: 22px;
    border-radius: 4px;
}

.section-collapse-btn:hover {
    opacity: 1;
    background: var(--bg-tertiary);
}

.section-collapse-btn .collapse-icon {
    transition: transform 0.2s;
    width: 12px;
    height: 12px;
}

.links-section.collapsed .section-collapse-btn .collapse-icon {
    transform: rotate(180deg);
}

.links-section.collapsed .links-grid {
    display: none;
}

.section-title {
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.2s;
}

.section-title:hover {
    background: var(--bg-tertiary);
}

.section-title[contenteditable="true"] {
    background: var(--bg-tertiary);
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.section-edit-btn,
.section-delete-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    width: 22px;
    height: 22px;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}

.section-edit-btn svg,
.section-delete-btn svg {
    width: 12px;
    height: 12px;
}

.section-edit-btn:hover {
    background: var(--border);
    border-color: var(--accent);
}

.section-delete-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
}

.add-section-container {
    display: flex;
    justify-content: center;
    padding: 20px;
}

.add-section-btn-large {
    background: var(--card-bg);
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 20px 40px;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1rem;
    transition: all 0.2s;
}

.add-section-btn-large:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--bg-tertiary);
}

.links-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.add-link-btn {
    background: var(--accent);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.add-link-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

.links-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.link-card {
    background: var(--bg-tertiary);
    border-radius: 8px;
    padding: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    min-height: 70px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.link-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.2);
}

.link-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent);
    transform: scaleX(0);
    transition: transform 0.2s;
}

.link-card:hover::before {
    transform: scaleX(1);
}

.link-icon {
    width: 28px;
    height: 28px;
    margin: 0 auto 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    background: var(--bg-secondary);
    color: var(--accent);
    font-weight: 600;
}

.link-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.link-icon .custom-icon {
    font-size: 1.4rem;
}

.link-name {
    font-size: 0.7rem;
    color: var(--text-primary);
    font-weight: 500;
    word-break: break-word;
    line-height: 1.2;
    margin-top: 2px;
}

.link-actions {
    position: absolute;
    top: 4px;
    right: 4px;
    display: flex;
    gap: 2px;
    opacity: 0;
    transition: opacity 0.2s;
}

.link-card:hover .link-actions {
    opacity: 1;
}

.action-btn {
    background: rgba(0, 0, 0, 0.6);
    border: none;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    backdrop-filter: blur(10px);
    padding: 0;
}

.action-btn svg {
    width: 10px;
    height: 10px;
}

.action-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.action-btn.delete:hover {
    background: rgba(239, 68, 68, 0.8);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s;
}

.modal.active {
    display: flex;
}

#authModal.active {
    background: var(--bg-primary);
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 30px;
    width: 90%;
    max-width: 450px;
    border: 1px solid var(--border);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s;
}

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

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

.modal-header h3 {
    font-size: 1.5rem;
    font-weight: 600;
}

.close-btn {
    background: transparent;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

.close-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: var(--accent);
}

.icon-picker-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.icon-preview {
    width: 60px;
    height: 60px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 8px;
    transition: all 0.2s;
}

.icon-preview.has-icon {
    border-color: var(--accent);
}

.icon-search {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.icon-search:focus {
    outline: none;
    border-color: var(--accent);
}

.icon-picker {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
    max-height: 350px;
    overflow-y: auto;
    padding: 8px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border);
}

/* Custom scrollbar for icon picker */
.icon-picker::-webkit-scrollbar {
    width: 8px;
}

.icon-picker::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.icon-picker::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.icon-picker::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

.icon-option {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background: var(--bg-secondary);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.icon-option:hover {
    background: var(--bg-primary);
    border-color: var(--accent);
    transform: scale(1.1);
}

.icon-option.selected {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.2);
}

.btn-icon-clear {
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    align-self: flex-start;
}

.btn-icon-clear:hover {
    background: var(--border);
    color: var(--text-primary);
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 25px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-cancel {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-cancel:hover {
    background: var(--border);
}

.btn-save {
    background: var(--accent);
    color: white;
}

.btn-save:hover {
    background: var(--accent-hover);
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.auth-tab {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
}

.auth-tab:hover {
    color: var(--text-primary);
}

.auth-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Settings Tabs (similar to auth tabs) */
.settings-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.settings-tab {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
}

.settings-tab:hover {
    color: var(--text-primary);
}

.settings-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.settings-tab-content {
    display: none;
}

.settings-tab-content.active {
    display: block;
}

.settings-modal-content {
    max-width: 1000px;
    width: 95%;
    max-height: 95vh;
    overflow-y: auto;
}

.settings-tab-content {
    max-height: calc(95vh - 150px);
    overflow-y: auto;
    padding-right: 10px;
}

/* OTP Setup Section - Better Layout */
#otpSetupSection {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    align-items: start;
}

@media (max-width: 900px) {
    #otpSetupSection {
        grid-template-columns: 1fr;
    }
}

#otpSetupSection .form-group:first-child {
    grid-column: 1 / -1;
}

#otpQRCode {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
    background: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    min-height: 250px;
}

#otpQRCode img {
    max-width: 100%;
    height: auto;
    max-height: 300px;
}

.auth-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
    display: none;
}

.auth-error.show {
    display: block;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.empty-state p {
    margin-bottom: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .time {
        font-size: 3rem;
    }
    
    .links-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 12px;
    }
    
    .link-card {
        padding: 15px;
    }
}
