@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;700&display=swap');

:root {
    --sidebar-bg: #2d3e50;
    --main-bg: #f0f2f5;
    --widget-bg: #ffffff;
    --accent-color: #f39c12;
    --primary-color: #3498db;
    --text-color-sidebar: #ecf0f1;
    --text-color-main: #34495e;
    --secondary-btn-bg: #bdc3c7;
    --border-color: #e0e0e0;
    --success-color: #2ecc71;
    --error-color: #e74c3c;
    --shadow-light: 0 4px 15px rgba(0, 0, 0, 0.08);
    --shadow-medium: 0 6px 20px rgba(0, 0, 0, 0.12);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Kanit', sans-serif;
}

body {
    background-color: var(--main-bg);
    color: var(--text-color-main);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

h2, h3, h4, h5 {
    color: var(--text-color-main);
    margin-bottom: 0.8rem;
    transition: color 0.3s ease;
}

#ambiance-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    z-index: -1;
    transition: background-image 2s ease-in-out, filter 2s ease-in-out;
}

#ambiance-background.rain-effect {
    filter: brightness(0.8) blur(3px);
}

.btn {
    border: none;
    padding: 0.7rem 1.4rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background-color 0.3s ease, transform 0.2s ease, filter 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 500;
}

.btn:hover {
    transform: translateY(-1px);
    filter: brightness(1.1);
}

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

.btn-secondary {
    background-color: var(--secondary-btn-bg);
    color: var(--text-color-main);
}

.btn-danger {
    background-color: var(--error-color);
    color: white;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

.btn-sidebar {
    width: 100%;
    margin-bottom: 0.8rem;
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-color-sidebar);
    text-align: left;
    padding: 0.8rem 1rem;
    justify-content: flex-start;
}

.btn-sidebar:hover {
    background-color: rgba(255, 255, 255, 0.2);
    filter: none;
}

.btn-sidebar i {
    width: 20px;
}

.btn-logout {
    background-color: var(--error-color);
    margin-top: auto;
}

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

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
    background-color: var(--main-bg);
    color: var(--text-color-main);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    color: var(--text-color-sidebar);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.15);
    transition: background-color 0.3s ease;
}

.main-content {
    flex-grow: 1;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.right-taskbar {
    width: 320px;
    padding: 2rem 1.5rem;
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    border-left: 1px solid var(--border-color);
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.05);
    overflow-y: auto;
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.header-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.widget-box {
    background-color: var(--widget-bg);
    border-radius: 10px;
    padding: 1rem;
    box-shadow: var(--shadow-light);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: top;
}

.widget-box:hover {
    box-shadow: var(--shadow-medium);
}

.clock-widget {
    align-items: center;
    font-weight: 600;
}

.clock-widget .time {
    font-size: 4.5rem;
    color: var(--text-color-main);
    margin-bottom: 0.25rem;
}

.clock-widget .date {
    font-size: 1rem;
    color: #aaa;
}

.weather-widget {
    text-align: center;
    gap: 0.5rem;
    min-height: 120px;
}

.weather-main-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.weather-main-info .temperature-value {
    font-size: 3.8rem;
    font-weight: 700;
    color: var(--text-color-main);
}

.weather-main-info i.fas {
    color: var(--accent-color);
    font-size: 3.5rem;
}

.weather-details p {
    margin: 0.1rem 0;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.main-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    grid-gap: 1.5rem;
    flex-grow: 1;
}

.profile-section {
    text-align: center;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.profile-img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent-color);
    margin-bottom: 0.8rem;
    box-shadow: 0 0 0 3px var(--sidebar-bg);
}

.profile-section h3 {
    color: var(--text-color-sidebar);
}

.links-section ul {
    list-style: none;
    margin-bottom: 1rem;
    padding: 0;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.widget-header h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: #999;
    font-style: italic;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.empty-state i {
    font-size: 2.5rem;
    color: #ccc;
}

/* --- Redesigned File Management Styles --- */

.drop-area {
    border: 2px dashed var(--border-color);
    border-radius: 10px;
    padding: 2rem;
    text-align: center;
    color: #aaa;
    margin-bottom: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: var(--main-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.drop-area i {
    font-size: 2.5rem;
    color: #ccc;
    transition: all 0.3s ease;
}

.drop-area p {
    margin: 0;
    font-size: 0.9rem;
}

.drop-area.highlight {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.drop-area.highlight i {
    color: white;
    transform: scale(1.1);
}

.drop-area.highlight .browse-files {
    color: white;
}

.drop-area .browse-files {
    color: var(--primary-color);
    font-weight: bold;
    text-decoration: underline;
}

.file-list {
    max-height: 250px;
    overflow-y: auto;
    padding-right: 10px;
}

.file-item {
    display: flex;
    align-items: center;
    padding: 0.8rem;
    border-radius: 8px;
    background-color: var(--main-bg);
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    margin-bottom: 0.5rem;
}

.file-item:hover {
    background-color: var(--widget-bg);
    box-shadow: var(--shadow-light);
}

.file-item-icon {
    font-size: 1.5rem;
    width: 40px;
    text-align: center;
    margin-right: 1rem;
    color: var(--primary-color);
}

.file-item-details {
    flex-grow: 1;
    overflow: hidden;
}

.file-item-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.95rem;
}

.file-item-size {
    font-size: 0.8rem;
    color: #aaa;
}

.file-item-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: 1rem;
}

.file-item-actions .btn-sm {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-color-main);
}

.file-item-actions .btn-sm:hover {
    background-color: var(--secondary-btn-bg);
    border-color: var(--secondary-btn-bg);
}

.file-item-actions .btn-danger {
    background-color: transparent;
    border: 1px solid var(--error-color);
    color: var(--error-color);
}

.file-item-actions .btn-danger:hover {
    background-color: var(--error-color);
    color: white;
}

/* --- End Redesigned Styles --- */

.media-hub-widget {
    overflow: hidden;
}

.media-hub-widget .widget-header {
    margin-bottom: 0;
}

.media-tabs {
    display: flex;
    gap: 0.5rem;
}

.media-tab-btn {
    background: transparent;
    color: #888;
    border: none;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 1rem;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.media-tab-btn.active,
.media-tab-btn:hover {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.media-tab-btn .fa-spotify {
    color: #1DB954;
    transition: color 0.3s ease;
}

.media-tab-btn.active .fa-spotify,
.media-tab-btn:hover .fa-spotify {
    color: white;
}

.media-content {
    flex-grow: 1;
    position: relative;
    padding-top: 1rem;
}

.media-view {
    display: none;
    flex-direction: column;
    height: 100%;
}

.media-view.active {
    display: flex;
}

.youtube-input-group,
.spotify-input-group {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.youtube-player {
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
    aspect-ratio: 16 / 9;
}

#youtube-player-container-wrapper {
    width: 100%;
}

#youtube-player-container,
#youtube-player-container iframe {
    width: 100%;
    height: 100%;
}

.spotify-content-area {
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spotify-content-area iframe {
    border-radius: 12px;
    border: none;
    height: 100%;
    width: 100%;
    min-height: 352px;
}

.task-input {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.task-list,
.task-history {
    list-style: none;
    padding: 0;
}

.task-list li,
.task-history li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border-color);
}

.task-list li input[type="checkbox"] {
    margin-left: 1rem;
    cursor: pointer;
    transform: scale(1.2);
    accent-color: var(--success-color);
}

.task-history-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.task-history li span {
    color: #888;
    text-decoration: line-through;
}

.task-history li .fas.fa-check-circle {
    color: var(--success-color);
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s 0.3s;
}

.modal.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease;
}

.modal-content {
    background-color: var(--widget-bg);
    padding: 2.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow-medium);
    width: 90%;
    max-width: 700px;
    position: relative;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: translateY(0);
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    color: #aaa;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close-btn:hover {
    color: var(--text-color-main);
}

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

.settings-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border-color);
}

.settings-tabs .tab-btn {
    background: transparent;
    color: #888;
    border: none;
    padding: 0.8rem 1.5rem;
    cursor: pointer;
    font-size: 1rem;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.settings-tabs .tab-btn.active {
    border-bottom-color: var(--primary-color);
    font-weight: bold;
    color: var(--primary-color);
}

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

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

#settings-file-list,
#settings-link-list,
#settings-task-list,
#settings-history-list {
    max-height: 300px;
    overflow-y: auto;
}

.theme-options {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.theme-choice {
    cursor: pointer;
    padding: 0.8rem;
    border: 2px solid transparent;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    transition: all 0.2s ease;
}

.theme-choice:hover {
    background-color: var(--main-bg);
}

.theme-choice.active {
    border-color: var(--primary-color);
}

.theme-swatch {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid var(--widget-bg);
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
}

.profile-settings-container {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 1.5rem;
    background-color: var(--main-bg);
    border-radius: 8px;
}

.settings-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem;
    border-bottom: 1px solid var(--border-color);
}

.settings-list-item span {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.settings-list-item:last-child {
    border-bottom: none;
}

.settings-footer-note {
    text-align: center;
    color: #aaa;
    font-size: 0.8rem;
    margin-top: 2rem;
}

#notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.notification {
    background-color: rgba(44, 62, 80, 0.9);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-medium);
    opacity: 0;
    transform: translateX(120%);
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification.error {
    background-color: rgba(231, 76, 60, 0.9);
}

.youtube-results-list {
    display: none;
    list-style: none;
    padding: 0;
    margin-top: 1rem;
    flex-grow: 1;
    overflow-y: auto;
    border-top: 1px solid var(--border-color);
}

.youtube-results-list.active {
    display: block;
}

.youtube-search-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.8rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-radius: 5px;
}

.youtube-search-item:hover {
    background-color: var(--main-bg);
}

.youtube-search-item:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
}

.youtube-search-item img {
    width: 120px;
    border-radius: 8px;
    flex-shrink: 0;
}

.youtube-search-item .video-details {
    overflow: hidden;
}

.youtube-search-item .video-title {
    font-weight: 500;
    font-size: 1rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.youtube-search-item .video-channel {
    font-size: 0.85rem;
    color: #888;
}

/* Right Sidebar Styles */
.right-sidebar {
    position: fixed;
    top: 0;
    right: -250px;
    /* Hidden by default */
    width: 250px;
    height: 100%;
    background-color: var(--sidebar-bg);
    color: var(--text-color-sidebar);
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.2);
    transition: right 0.3s ease-in-out;
    z-index: 1002;
    display: flex;
    flex-direction: column;
}

.right-sidebar.active {
    right: 0;
    /* Show sidebar */
}

.sidebar-toggle-button {
    position: absolute;
    left: -40px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 80px;
    background-color: var(--sidebar-bg);
    border: none;
    color: var(--text-color-sidebar);
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 10px 0 0 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: brightness(85%);
    transition: filter 0.2s ease-in-out;
}

.sidebar-toggle-button:hover {
    filter: brightness(100%);
}

.sidebar-toggle-button i {
    transition: transform 0.3s ease-in-out;
}

.right-sidebar.active .sidebar-toggle-button i {
    transform: rotate(180deg);
}

.right-sidebar .sidebar-content {
    padding: 1.5rem;
    overflow-y: auto;
}

.right-sidebar .sidebar-header {
    text-align: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.right-sidebar .sidebar-header h3 {
    color: var(--text-color-sidebar);
    margin: 0;
}

.sidebar-menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu-list li a {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.8rem 1rem;
    text-decoration: none;
    color: var(--text-color-sidebar);
    border-radius: 5px;
    transition: background-color 0.2s ease;
}

.sidebar-menu-list li a:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Calendar Widget Styles */
.calendar-widget {
    padding: 1rem;
}

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

.calendar-header h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 500;
}

.calendar-nav button {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-color-main);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
}

.calendar-nav button:hover {
    background-color: var(--main-bg);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    text-align: center;
}

.calendar-grid>div {
    padding: 0.2rem 0;
    font-size: 0.8rem;
    border-radius: 1px;
    min-height: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    box-sizing: border-box;
}

.calendar-day-name {
    font-weight: 700;
    color: #999;
    font-size: 0.75rem;
}

.calendar-date {
    cursor: pointer;
    transition: background-color 0.1s ease, color 0.1s ease;
}

.calendar-date:hover {
    background-color: var(--main-bg);
}

.calendar-date.other-month {
    color: #ccc;
    cursor: default;
}

.calendar-date.other-month:hover {
    background-color: transparent;
}

.calendar-date.current-day {
    background-color: var(--primary-color);
    color: white;
    font-weight: 700;
}

.calendar-date:not(.other-month):hover {
    background-color: var(--secondary-btn-bg);
}

/* สไตล์สำหรับกิจกรรมที่ถูกปรับปรุงใหม่ (จากจุดเป็นแถบ) */
.calendar-event-indicator {
    display: inline-block;
    width: 15px;
    /* เพิ่มความกว้าง */
    height: 1px;
    /* เพิ่มความหนา */
    border-radius: 5px;
    margin-top: 1px;
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
}