/* Meowloader-inspired Theme for Meownotes */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --bg-color: #050505;
    --card-bg: #0a0a0a;
    --sidebar-bg: #0a0a0a;
    /* Fallback */
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --accent-color: #fbb1ad;
    --accent-secondary: #ffd590;
    --accent-hover: #ff9595;
    --gradient-primary: linear-gradient(135deg, var(--accent-color) 0%, var(--accent-secondary) 100%);
    --glass-bg: rgba(20, 20, 20, 0.6);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glow-shadow: 0 0 100px rgba(251, 177, 173, 0.25);
    --success-color: #00e676;
    --error-color: #ff1744;
    --border-color: #333333;
    --input-bg: #1a1a1a;
    --transition: all 0.3s ease;
    --font-family: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    width: 100%;
}
/* Auth View Centering */
#auth-view {
     display: flex;
     justify-content: center;
     align-items: center;
     min-height: 100vh;
     background: var(--bg-color);
}

/* Glass Card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: var(--glow-shadow);
    margin-bottom: 3rem;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    color: var(--text-primary);
}

a {
    text-decoration: none;
    color: inherit;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.container {
    width: 100%;
    max-width: 900px;
    padding: 2rem;
    position: relative;
    z-index: 1;
    margin: 0 auto; /* Center it */
}

/* Utility to hide elements */
.hidden {
    display: none !important;
}

/* Forms & Inputs */
.input-group {
    position: relative;
    margin-bottom: 1rem;
}

.input-group i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    z-index: 1;
}

input,
select,
textarea {
    width: 100%;
    padding: 1rem;
    padding-left: 1rem; /* Default padding */
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

.input-group input {
    padding-left: 2.5rem; /* Space for icon */
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(251, 177, 173, 0.2);
}

/* Buttons */
.btn-primary,
.btn {
    background: var(--gradient-primary);
    color: #000;
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary:hover,
.btn:hover {
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(251, 177, 173, 0.3);
}

.btn-secondary {
    background: var(--input-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1rem; /* Adjust padding for secondary */
    width: auto;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: #222;
    border-color: var(--accent-color);
    transform: translateY(-1px);
}

.btn-danger {
    background: rgba(255, 77, 77, 0.1);
    border: 1px solid rgba(255, 77, 77, 0.3);
    color: var(--error-color);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.btn-danger:hover {
    background: rgba(255, 77, 77, 0.2);
    border-color: var(--error-color);
    transform: translateY(-1px);
}

/* Modern Input Wrapper (for search bars etc) */
.modern-input-wrapper {
    position: relative;
    display: flex;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.5rem;
    transition: var(--transition);
}

.modern-input-wrapper:focus-within {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(251, 177, 173, 0.2);
}

.modern-input-wrapper input {
    border: none;
    background: transparent;
    padding: 0.5rem;
    box-shadow: none;
}

/* Logout Button specifically */
.btn-logout {
    background: rgba(255, 77, 77, 0.1);
    border: 1px solid rgba(255, 77, 77, 0.3);
    color: var(--error-color);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.btn-logout:hover {
    background: rgba(255, 77, 77, 0.2);
    border-color: var(--error-color);
    transform: translateY(-1px);
    opacity: 1;
    box-shadow: none;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.9rem;
}

/* Inputs & Search */
input,
textarea,
select {
    width: 100%;
    padding: 1rem;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(251, 177, 173, 0.2);
}

.search-container {
    margin-bottom: 2rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

#search-bar {
    flex: 1;
}

/* Filter Dropdown */
.filter-dropdown-container {
    position: relative;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    /* glass border? */
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    min-width: 220px;
    z-index: 100;
    padding: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
}

.dropdown-content.show {
    display: block;
}

.dropdown-item {
    padding: 0.6rem 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border-radius: 4px;
    color: var(--text-secondary);
    transition: var(--transition);
}

.dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.dropdown-item.selected {
    background: rgba(251, 177, 173, 0.1);
    color: var(--accent-color);
}

/* Note Cards (Glassmorphism) */
.note-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--glow-shadow);
    box-shadow: var(--glow-shadow), 0 4px 6px rgba(0, 0, 0, 0.1);
    /* default less glow */
    transition: var(--transition);
    animation: fadeIn 0.3s ease;
}

.note-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-color);
    box-shadow: 0 8px 24px rgba(251, 177, 173, 0.15);
}

.note-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.5rem;
}

.note-content {
    color: var(--text-primary);
    line-height: 1.6;
    margin-bottom: 1rem;
    white-space: pre-wrap;
    word-break: break-word;
}

.note-image {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 1rem;
    border: 1px solid var(--border-color);
}

.note-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    justify-content: flex-end;
}

/* Tags */
.note-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
    margin-bottom: 0.75rem;
}

.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(251, 177, 173, 0.15);
    color: var(--accent-color);
    border: 1px solid rgba(251, 177, 173, 0.3);
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--card-bg);
    margin: 10% auto;
    padding: 2rem;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 500px;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    position: relative;
    animation: scaleIn 0.2s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close {
    color: var(--text-secondary);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

.close:hover {
    color: var(--text-primary);
}

/* Form Groups in Modal */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Tag Selector in Modal */
.tag-selector-wrapper {
    position: relative;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    background: var(--input-bg);
    min-height: 48px;
}

.selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.selected-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.2rem 0.6rem;
    background: var(--accent-color);
    color: #000;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.selected-tag .remove {
    cursor: pointer;
    opacity: 0.6;
}

.selected-tag .remove:hover {
    opacity: 1;
}

.btn-add-tag {
    background: transparent;
    border: 1px dashed var(--text-secondary);
    color: var(--text-secondary);
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
}

.btn-add-tag:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.tag-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 0.5rem;
    padding: 0.5rem;
    z-index: 10;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.existing-tag-item {
    padding: 0.5rem;
    cursor: pointer;
    border-radius: 4px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.existing-tag-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

/* Custom Tag Input area */
.custom-tag-input {
    display: flex;
    gap: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
    margin-top: 0.5rem;
}

.custom-tag-input input {
    padding: 0.4rem;
    font-size: 0.9rem;
}

.custom-tag-input button {
    background: var(--accent-color);
    color: #000;
    border: none;
    border-radius: 6px;
    padding: 0 0.8rem;
    cursor: pointer;
    font-weight: 600;
}

/* Floating Action Button */
.fab-btn {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(251, 177, 173, 0.4);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    z-index: 90;
}

.fab-btn:hover {
    transform: scale(1.1) rotate(5deg);
}

.fab-btn img {
    width: 24px;
    height: 24px;
    filter: brightness(0);
    /* Make icon black to contrast with gradient */
}

/* Back to Top */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 90;
}

.back-to-top.show {
    opacity: 1;
    visibility: visible;
}

.back-to-top:hover {
    background: var(--card-bg);
    border-color: var(--accent-color);
    transform: translateY(-5px);
}

.back-to-top img {
    width: 20px;
    height: 20px;
    filter: invert(1);
    /* Assuming default is dark icon, invert for dark mode */
}

/* Link Embeds */
.link-embed {
    background: rgba(0, 0, 0, 0.3);
    border-left: 3px solid var(--accent-color);
    border-radius: 8px;
    padding: 0.75rem;
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.embed-content {
    flex: 1;
    overflow: hidden;
}

.embed-title {
    color: var(--accent-color);
    font-weight: 600;
    text-decoration: none;
    display: block;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.embed-site {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.embed-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.embed-thumbnail img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
}

.video-container {
    width: 100%;
    border-radius: 8px;
    overflow: hidden;
    background: transparent;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: center;
    background: #000;
    /* Re-add background for cinema feel but only exactly around video? No, user hated empty space. Let's keep transparent container but ensure video fills it. */
}

.video-container video {
    width: 100%;
    /* Force upscale to fit container */
    height: auto;
    max-width: 100%;
    max-height: 70vh;
    /* Allow it to be quite tall but not screen-filling */
    display: block;
    object-fit: contain;
    /* Ensure aspect ratio is preserved */
    background: #000;
    /* Video itself can be black background if letterboxed by object-fit */
}

/* For iframes, we still might want 100% width usually, but let's ensure no black bars if possible */
.video-container.iframe-container {
    width: 100%;
    /* Use modern aspect-ratio. 16/9 is standard for YouTube/Twitch etc. */
    aspect-ratio: 16 / 9;
    height: auto;
    background: transparent;
    /* Remove black bg so if video fits it's seamless */
    display: block;
    /* Override flex from .video-container if needed */
}

/* Ensure iframe strictly fills the container */
.video-container.iframe-container iframe {
    width: 100%;
    height: 100%;
    display: block;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive Sidebar Layout */
#dashboard-view {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    position: fixed;
    height: 100vh;
    z-index: 100;
    left: 0;
    top: 0;
    bottom: 0;
}

.sidebar .logo {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar .logo span {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.app-logo {
    height: 1em;
    vertical-align: middle;
    margin-right: 0.5rem;
}

.nav-links {
    list-style: none;
    flex: 1;
}

.nav-links li {
    margin-bottom: 0.5rem;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-links li:hover,
.nav-links li.active {
    background: rgba(251, 177, 173, 0.1);
    color: var(--accent-color);
}

.user-profile {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}

.user-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

#logout-btn {
    background: rgba(255, 77, 77, 0.1);
    border: 1px solid rgba(255, 77, 77, 0.3);
    color: var(--error-color);
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    transition: var(--transition);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#logout-btn:hover {
    background: rgba(255, 77, 77, 0.2);
    border-color: var(--error-color);
    transform: translateY(-1px);
}

.content {
    flex: 1;
    margin-left: 250px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
}

.section {
    width: 100%;
    max-width: 1200px; /* Center content on desktop */
    margin: 0 auto;
    display: none;
    animation: fadeIn 0.3s ease;
}

.section.active {
    display: block;
}

/* Auth View Overlay */
#auth-view {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--bg-color);
}

#auth-view .auth-container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
}

#auth-view .logo {
    text-align: center;
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 2rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

@media (max-width: 768px) {
    #dashboard-view {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        padding: 1rem;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .sidebar .logo {
        margin-bottom: 1rem;
    }

    .nav-links {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        padding-bottom: 0.5rem;
    }

    .nav-links li {
        margin-bottom: 0;
        white-space: nowrap;
        padding: 0.5rem 0.8rem;
        font-size: 0.9rem;
        flex: 1 1 auto;
        justify-content: center;
    }

    .user-profile {
        position: absolute;
        top: 1rem;
        right: 1rem;
        border: none;
        padding: 0;
        margin: 0;
    }

    .user-info {
        display: none;
    }

    #logout-btn span {
        display: none;
    }
    
    #logout-btn {
        width: auto;
        padding: 0.5rem;
        font-size: 1rem;
    }

    .content {
        margin-left: 0;
        padding: 1rem;
        width: 100%;
        overflow-x: hidden;
    }
    
    .fab-btn {
         bottom: 1.5rem;
         right: 1.5rem;
         left: auto;
    }
}

/* Timer / Reminder Items */
.timer-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.timer-item {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    animation: fadeIn 0.3s ease;
    transition: var(--transition);
}

.timer-item:hover {
    transform: translateY(-2px);
    border-color: var(--accent-color);
    box-shadow: 0 8px 24px rgba(251, 177, 173, 0.15);
}

.timer-details {
    flex: 1;
    min-width: 0; /* Important for flex child to shrink */
    word-break: break-word;
}

.timer-details h3 {
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
    white-space: normal;
}

.timer-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.timer-meta span {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.timer-actions {
    display: flex;
    gap: 0.5rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
    font-style: italic;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    border: 1px dashed var(--border-color);
}