/* --- Global & General Styles (Apply to both edit.php and display.html) --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol";
    line-height: 1.6;
    margin: 0;
    background-color: #f4f7f6; /* Default light gray background for pages like edit.php */
    color: #333;
    /* height and width for display.html are handled by .display-page-active */
}

.container { /* Primarily for edit.php layout */
    max-width: 1000px;
    margin: 20px auto;
    padding: 20px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

h1, h2, h3, h4, h5 {
    color: #2c3e50;
    margin-top: 0;
}
h1 { font-size: 2em; margin-bottom: 0.75em; }
h2 { font-size: 1.6em; margin-bottom: 0.6em; border-bottom: 1px solid #ecf0f1; padding-bottom: 0.3em;}
h3 { font-size: 1.3em; margin-bottom: 0.5em; }
h4 { font-size: 1.1em; margin-bottom: 0.4em; color: #34495e; } /* Slightly different color for H4 */
h5 { font-size: 1em; margin-bottom: 0.5em; color: #7f8c8d; text-transform: uppercase; letter-spacing: 0.5px;}


label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #34495e;
    font-size: 0.9em; /* Slightly smaller label */
}

input[type="text"],
input[type="number"],
input[type="url"], /* Added for redirect URL input */
select {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #dcdcdc;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1em;
    background-color: #fff; /* Ensure white background for inputs */
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}
input[type="text"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
select:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}
input[readonly] {
    background-color: #ecf0f1 !important; /* Light gray for readonly inputs */
    cursor: default;
}


input.short-input { /* For edit.php */
    width: auto;
    min-width: 250px;
    max-width: 400px;
    display: inline-block;
    vertical-align: middle;
}
input.time-input { /* For edit.php */
    width: 80px;
    display: inline-block;
    margin-right: 5px;
    text-align: center;
}

button, .button {
    background-color: #3498db;
    color: white;
    padding: 10px 18px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    text-decoration: none;
    display: inline-block;
    transition: background-color 0.2s ease-in-out, transform 0.1s ease;
    margin-right: 8px;
    margin-bottom: 8px;
    vertical-align: middle;
}
button:hover, .button:hover {
    background-color: #2980b9;
    transform: translateY(-1px); /* Slight lift on hover */
}
button:active, .button:active {
    transform: translateY(0px); /* Press down effect */
}


button.danger-btn, .button.danger-btn { background-color: #e74c3c; }
button.danger-btn:hover, .button.danger-btn:hover { background-color: #c0392b; }

button.secondary-btn, .button.secondary-btn { background-color: #f39c12; }
button.secondary-btn:hover, .button.secondary-btn:hover { background-color: #e67e22; }


/* --- Message Styles (Used by both edit.php and display.html's #message-container) --- */
.msg {
    padding: 15px 20px;
    margin: 20px 0; /* Consistent margin for messages within content flow */
    border-radius: 4px;
    border-left-width: 5px;
    border-left-style: solid;
    font-size: 0.95em;
    box-sizing: border-box;
}
.msg p { margin: 0; }
.msg.success { background-color: #e6fffa; border-color: #1abc9c; color: #16a085; }
.msg.error   { background-color: #ffebee; border-color: #e74c3c; color: #c0392b; }
.msg.warning { background-color: #fff8e1; border-color: #f39c12; color: #e67e22; }
.msg.info    { background-color: #e7f3fe; border-color: #3498db; color: #2980b9; }


/* --- Edit Page Specific Styles (`edit.php`) --- */
.edit-page .section-block {
    border: 1px solid #ecf0f1;
    padding: 25px; /* Increased padding */
    margin-bottom: 30px; /* Increased margin */
    border-radius: 6px;
    background-color: #ffffff;
}
.edit-page .form-inline {
    display: flex;
    align-items: flex-end;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.edit-page .form-inline > div { flex-grow: 1; min-width: 200px; /* Prevent extreme squishing */ }
.edit-page .form-inline label { margin-bottom: 3px; }
.edit-page .form-inline input, .edit-page .form-inline select { margin-bottom: 0; }
.edit-page .book-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; flex-wrap: wrap; gap: 10px; }
.edit-page .logout-link-container { text-align: right; margin-bottom: 15px; }

.edit-page .entry {
    border-bottom: 1px solid #e0e0e0; /* Slightly darker border */
    padding-bottom: 20px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px; /* Increased gap */
    align-items: flex-end;
}
.edit-page .entry:last-of-type { border-bottom: none; margin-bottom: 0; }
.edit-page .key-input    { flex: 2 1 250px; }
.edit-page .value-input  { flex: 1 1 200px; }
.edit-page .time-inputs  { flex: 1 1 180px; }
.edit-page .delete-input { flex: 0 0 auto; margin-left: auto; padding-top: 28px; /* Maintain alignment */}
.edit-page .delete-input input[type="checkbox"] { width: 18px; height: 18px; vertical-align: middle; margin-right: 5px;}
.edit-page .delete-label { font-weight: normal; color: #c0392b; cursor: pointer; }

.edit-page .add-new-header {
    padding-bottom: 15px;
    margin-bottom: 25px;
    border-bottom: 2px solid #3498db; /* Accent border */
}
.edit-page .add-new-header h5 { margin-bottom: 15px; font-size: 1.1em; }

.edit-page .new-entry-section {
    /* Removed default styling, now using .entry within .add-new-header */
}
.edit-page .new-entry-section .entry { /* Used for new item layout inside add-new-header */
    border-bottom: none !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
    background-color: #f8f9fa; /* Light background for new entry area */
    padding: 15px !important;
    border-radius: 4px;
}


.edit-page .share-link-and-qr { width: 100%; display: flex; align-items: flex-start; gap: 20px; margin-top:15px; flex-wrap: wrap; }
.edit-page .share-link-and-qr .share-link-section { flex: 1 1 300px; margin-top:0; } /* Allow link to grow */
.edit-page .share-link-and-qr .qr-code-container { flex-shrink: 0; margin-top: 0; text-align: center; /* Center QR if it's alone */}
.edit-page .share-link-and-qr .qr-code-container label {text-align: left;} /* Align label left */
.edit-page .share-link-and-qr .qr-code-container img { border: 1px solid #e0e0e0; padding: 5px; background-color: #fff; max-width: 120px; height: auto; display: block; margin-top: 3px; }

.edit-page .save-button-top { margin-bottom: 25px !important; font-weight: bold; }


/* Styles for login page elements used in edit.php */
.login-page-container { max-width: 450px; margin: 60px auto; padding: 30px; background-color: #fff; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.1); }
.login-page-container h1 { text-align: center; margin-bottom: 25px; color: #2c3e50; font-size:1.8em;}
.login-page-container .form-group { margin-bottom: 20px; }
/* login-page-container uses general label, input, button styles now */
.login-error-message { /* Uses .msg.error */ }


/* --- Display Page Specific Styles (`display.html`) --- */
body.display-page-active {
    background-color: #000000; /* Default black for video, JS might change for messages */
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

#video-player-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

#video-player-wrapper iframe#youtube-player {
    width: 100%;
    height: 100%;
    border: none;
    display: none; /* JS will show it when video is ready */
}

#message-container { /* For display.html messages, uses .msg for styling */
    display: none; /* JS shows it */
    max-width: 90%;
    width: auto;
    min-width: 300px;
    text-align: center;
    z-index: 100;
    /* Centering is now primarily handled by body.display-page-active flex properties */
    /* Specific margin might be needed if .msg general margin isn't desired */
    margin: 0 auto; /* Override .msg margin to ensure centering by flex */
}