/* Global Box Sizing */
html {
  box-sizing: border-box;
}
*, *::before, *::after {
  box-sizing: inherit;
}

/* General Body Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f0f2f5;
    color: #333;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-image: url('background.png'); /* Assumes background.png is in css/ directory */
    background-repeat: repeat;
    background-size: auto; /* Or cover, depending on image */
    background-attachment: fixed;
    background-position: center center;
    /* You may need to adjust opacity of the image itself or add an overlay for subtlety */
}

/* Container for Login/Register Forms */
.container {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

h2 {
    text-align: center;
    color: #1c1e21;
    margin-bottom: 1.5rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #606770;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #dddfe2;
    border-radius: 6px;
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: #1877f2;
    box-shadow: 0 0 0 2px rgba(24, 119, 242, 0.2);
}

button {
    width: 100%;
    padding: 0.75rem;
    background-color: #1877f2;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #166fe5;
}

p {
    text-align: center;
    margin-top: 1rem;
    color: #606770;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

a {
    color: #1877f2;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Dashboard Styles */
.dashboard-container {
    width: 100%;
    max-width: 1200px;
    margin: 2rem;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.dashboard-container header {
    padding: 1rem 2rem;
    border-bottom: 1px solid #dddfe2;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-container nav a {
    margin-left: 1.5rem;
    font-weight: 600;
    transition: background-color 0.3s ease, color 0.3s ease; /* Smooth transition */
}

.dashboard-container nav a:hover {
    background-color: #166fe5; /* A slightly darker blue */
    color: #fff;
    border-radius: 4px; /* Apply border-radius on hover */
}

.dashboard-container main {
    padding: 2rem;
}

.dashboard-container section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    border: 1px solid #dddfe2;
    border-radius: 6px;
}

/* Blockchain Specific Styles */
#chain-container {
    margin-top: 1.5rem;
}

.block {
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 1rem;
    padding: 1rem;
    word-wrap: break-word;
}

.block-header {
    font-weight: bold;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    color: #1877f2;
}

.hash {
    font-family: monospace;
    font-size: 0.9rem;
    color: #666;
}

.mine-form {
    margin-top: 1rem;
}

.mine-form h3 {
    margin-top: 0;
}

.mine-form textarea {
    width: 100%;
    min-height: 80px;
    padding: 0.5rem;
    border: 1px solid #dddfe2;
    border-radius: 6px;
    margin-bottom: 1rem;
    max-width: 100%;
    box-sizing: border-box;
}

/* YouTube Gallery Styles */
.youtube-form {
    display: flex;
    margin-bottom: 1.5rem;
}

.youtube-form input {
    flex-grow: 1;
    padding: 0.75rem;
    border: 1px solid #dddfe2;
    border-radius: 6px 0 0 6px;
    font-size: 1rem;
}

.youtube-form button {
    width: auto;
    border-radius: 0 6px 6px 0;
}

#video-gallery-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 1rem;
}

.video-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.video-wrapper iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
}

/* Style for the new delete video button */
.delete-video-btn {
    width: 100%;
    background-color: #fa3e3e;
    color: white;
    border: none;
    padding: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 0; /* Full width button inside the wrapper */
    transition: background-color 0.3s;
}

.delete-video-btn:hover {
    background-color: #e03030;
}

/* To-Do List Styles */
.todo-form {
    display: flex;
    margin-bottom: 1.5rem;
}

.todo-form input {
    flex-grow: 1;
    padding: 0.75rem;
    border: 1px solid #dddfe2;
    border-radius: 6px 0 0 6px;
    font-size: 1rem;
}

.todo-form button {
    width: auto;
    border-radius: 0 6px 6px 0;
}

#task-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#task-list li {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    background-color: #f9f9f9;
    border-bottom: 1px solid #e0e0e0;
}

#task-list li:last-child {
    border-bottom: none;
}

#task-list li.completed span {
    text-decoration: line-through;
    color: #999;
}

#task-list input[type="checkbox"] {
    margin-right: 1rem;
    width: 18px;
    height: 18px;
}

#task-list span {
    flex-grow: 1;
}

#task-list .delete-btn {
    background-color: #fa3e3e;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

#task-list .delete-btn:hover {
    background-color: #e03030;
}

/* Responsive adjustments for small screens */
@media (max-width: 380px) { /* Adjust breakpoint for video notes panel */
    .video-notes-panel {
        width: 100vw; /* Take full viewport width */
        right: -100vw; /* Hide fully off-screen */
    }

    .video-notes-panel.open {
        right: 0; /* Slide in fully */
    }
}

@media (max-width: 320px) {
    body {
        padding: 0;
        margin: 0;
        border: none;
        display: block; /* Override default flex from larger screens */
    }

    .dashboard-container {
        margin: 0;
        border-radius: 0;
        box-shadow: none;
        border: none;
    }

    .dashboard-container header {
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem;
    }

    .dashboard-container nav {
        margin-top: 1rem;
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    .dashboard-container nav a {
        margin: 0.5rem 0;
        padding: 0.5rem;
        background-color: #f0f2f5;
        border-radius: 4px;
        text-align: center;
    }
    .dashboard-container nav a:hover {
        background-color: #166fe5; /* A slightly darker blue for responsive nav */
        color: #fff;
    }

    .dashboard-container main {
        padding: 1rem;
    }
    
    .dashboard-container section {
        padding: 1rem;
    }

    .youtube-form, .todo-form {
        flex-direction: column;
    }

    .youtube-form input, .todo-form input {
        border-radius: 6px;
        margin-bottom: 0.5rem;
    }

    .youtube-form button, .todo-form button {
        width: 100%;
        border-radius: 6px;
    }

    #video-gallery-container {
        grid-template-columns: 1fr; /* Ensure single column on small screens */
    }
}

/* Video Notes Panel Styles */
.video-notes-panel {
    position: fixed;
    top: 0;
    right: -400px; /* Initially hidden off-screen */
    width: 380px;
    height: 100%;
    background-color: #fff;
    box-shadow: -4px 0 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
    transition: right 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    box-sizing: border-box;
}

.video-notes-panel.open {
    right: 0; /* Slide in when open */
}

.video-notes-panel .panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #dddfe2;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.video-notes-panel .panel-header h3 {
    margin: 0;
    color: #1c1e21;
}

.video-notes-panel .close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #606770;
    padding: 0;
    width: auto; /* Override general button style */
}

.video-notes-panel .close-btn:hover {
    color: #333;
}

.video-notes-panel .panel-body {
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 5px; /* For scrollbar */
}

.video-notes-panel .panel-body .form-group input,
.video-notes-panel .panel-body .form-group textarea {
    width: 100%;
    max-width: 100%;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    border: 1px solid #dddfe2;
    border-radius: 6px;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.video-notes-panel .panel-body .form-group label {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
    color: #606770;
}

.video-notes-panel .panel-body button[type="submit"] {
    width: 100%;
    padding: 0.75rem;
    margin-top: 1rem;
    border-radius: 6px;
    background-color: #1877f2;
    color: #fff;
    font-weight: 600;
}

.video-notes-panel .panel-body h4 {
    margin-top: 2rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

#notes-list {
    list-style: none;
    padding: 0;
}

.video-note-item {
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
    word-wrap: break-word;
}

.video-note-item h4 {
    margin-top: 0;
    margin-bottom: 0.5rem;
    color: #1877f2;
    font-size: 1rem;
}

.video-note-item p {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.4;
    text-align: left; /* Override global p alignment */
    color: #555;
}

.video-note-item .note-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.video-note-item .note-actions button {
    padding: 0.5rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 4px;
    width: auto;
}

.video-note-item .edit-note-btn {
    background-color: #28a745;
}

.video-note-item .edit-note-btn:hover {
    background-color: #218838;
}

.video-note-item .delete-note-btn {
    background-color: #dc3545;
}

.video-note-item .delete-note-btn:hover {
    background-color: #c82333;
}

.no-notes-message {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    margin-top: 2rem;
}
