/* --- Admin Area Styles --- */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    background-color: #f0f2f5; /* Light grey background for the whole admin area */
    color: #333;
    font-size: 14px; /* Slightly smaller base font for admin UI */
    line-height: 1.5;
}

.admin-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh; /* Full viewport height */
}

.admin-header {
    background: #2c3e50; /* Dark blue/charcoal */
    color: #ecf0f1; /* Light grey/white text */
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    position: sticky; /* Make admin header sticky */
    top: 0;
    z-index: 1010; /* Higher than main site header if it's also sticky */
}
.admin-header h1 {
    margin: 0;
    font-size: 1.6em; /* Adjusted size */
    font-weight: 500;
}
.admin-header .user-info {
    display: flex;
    align-items: center;
    font-size: 0.9em;
}
.admin-header .user-info span {
    margin-right: 15px;
}

.admin-nav {
    background: #34495e; /* Slightly lighter blue/charcoal */
    padding: 0 25px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    /* For sticky nav, uncomment below and adjust admin-content padding-top */
    /* position: sticky; */
    /* top: 60px; */ /* Height of admin-header */
    /* z-index: 1000; */
}
.admin-nav ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap; /* Allow nav items to wrap on smaller screens */
}
.admin-nav ul li a {
    display: block;
    color: #ecf0f1;
    text-decoration: none;
    padding: 12px 15px;
    font-weight: 500;
    transition: background-color 0.2s ease, color 0.2s ease;
    border-bottom: 3px solid transparent; /* For active state indication */
}
.admin-nav ul li a:hover {
    background-color: #2c3e50;
    color: #fff;
}
.admin-nav ul li a.active {
    background-color: #2980b9; /* A distinct blue for active */
    color: #fff;
    border-bottom-color: #ecf0f1; /* White underline for active */
}


.admin-content {
    flex-grow: 1; /* Takes up remaining vertical space */
    padding: 25px;
    background-color: #fff; /* White background for content area */
    margin: 20px; /* Spacing around main content area */
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); /* More pronounced shadow */
    /* padding-top: 80px; */ /* Add this if admin-nav is sticky and admin-header is also sticky */
}
.admin-content h2 {
    font-size: 1.8em;
    color: #2c3e50;
    margin-top: 0;
    margin-bottom: 25px; /* More space after H2 */
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 15px;
}

.admin-footer {
    text-align: center;
    padding: 20px; /* Increased padding */
    background-color: #ecf0f1; /* Light grey */
    color: #7f8c8d; /* Muted text color */
    font-size: 0.9em;
    border-top: 1px solid #dcdcdc;
    margin-top: auto; /* Pushes footer to bottom if content is short */
}

/* Forms in Admin Area */
.content-form .form-group {
    margin-bottom: 20px;
}
.content-form label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px; /* Increased space */
    color: #495057; /* Darker grey for labels */
}
.content-form input[type="text"],
.content-form input[type="file"],
.content-form textarea {
    width: 100%;
    padding: 10px 12px; /* Adjusted padding */
    border: 1px solid #ced4da; /* Standard Bootstrap-like border color */
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1em;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background-color: #fff; /* Ensure white background */
}
.content-form input[type="text"]:focus,
.content-form textarea:focus {
    outline: none;
    border-color: #80bdff; /* Light blue focus (Bootstrap-like) */
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}
.content-form input[type="file"] {
    padding: 8px; /* Slightly less padding for file input */
}
.content-form textarea {
    min-height: 150px;
    resize: vertical; /* Allow vertical resizing */
}
.content-form small {
    display: block;
    margin-top: 6px; /* Increased space */
    color: #6c757d; /* Muted grey for help text */
    font-size: 0.875em;
}
.content-form img { /* For displaying current image in edit form */
    border:1px solid #ddd; padding: 3px; background: #f9f9f9;
}


/* Buttons in Admin */
.button {
    display: inline-block;
    padding: 10px 18px;
    font-size: 0.95em;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: 1px solid transparent; /* Base border */
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    line-height: 1.5; /* Ensure text is centered for different paddings */
}
.button-primary { background-color: #007bff; border-color: #007bff; color: #fff; }
.button-primary:hover { background-color: #0069d9; border-color: #0062cc; }

.button-logout { background-color: #dc3545; border-color: #dc3545; color: #fff; }
.button-logout:hover { background-color: #c82333; border-color: #bd2130; }

.button-add { background-color: #28a745; border-color: #28a745; color: #fff; }
.button-add:hover { background-color: #218838; border-color: #1e7e34; }

.button-edit { background-color: #ffc107; border-color: #ffc107; color: #212529; margin-right: 5px;}
.button-edit:hover { background-color: #e0a800; border-color: #d39e00; }

.button-delete { background-color: #dc3545; border-color: #dc3545; color: #fff; } /* Same as logout, good for destructive */
.button-delete:hover { background-color: #c82333; border-color: #bd2130; }

.button-view { background-color: #6c757d; border-color: #6c757d; color: #fff; margin-right: 5px;}
.button-view:hover { background-color: #5a6268; border-color: #545b62; }

.button.default, button:not([class*="button-"]){ /* For cancel or less prominent buttons */
    background-color: #f8f9fa;
    border-color: #ced4da;
    color: #343a40;
}
.button.default:hover, button:not([class*="button-"]):hover{
    background-color: #e2e6ea;
    border-color: #dae0e5;
}

.actions a.button { margin-bottom: 5px; white-space:nowrap; }


/* Messages (Success/Error) */
.message {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-size: 0.95em;
    border: 1px solid transparent;
    line-height: 1.4;
}
.message.success {
    background-color: #d4edda; /* Light green */
    color: #155724; /* Dark green text */
    border-color: #c3e6cb;
}
.message.error, .error-message { /* .error-message for login form */
    background-color: #f8d7da; /* Light red */
    color: #721c24; /* Dark red text */
    border-color: #f5c6cb;
}
.error-message { /* Specific for login */
    padding: 10px;
    margin-bottom: 15px;
    text-align: center;
}
.message a.button { font-size: 0.9em; padding: 5px 10px; margin-left: 5px;}


/* Table Styling for Manage Posts */
.content-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    font-size: 0.9em;
    box-shadow: 0 0 10px rgba(0,0,0,0.05);
    background-color: #fff; /* Ensure table background is white */
}
.content-table th,
.content-table td {
    border: 1px solid #e0e0e0; /* Lighter border */
    padding: 10px 12px;
    text-align: left;
    vertical-align: middle;
}
.content-table thead th {
    background-color: #f8f9fa; /* Very light grey for table header */
    font-weight: 600;
    color: #495057; /* Dark grey text for header */
}
.content-table tbody tr:nth-child(even) {
    background-color: #fdfdfd; /* Very subtle striping */
}
.content-table tbody tr:hover {
    background-color: #f1f1f1; /* Slightly darker hover */
}
.no-image {
    color: #999;
    font-style: italic;
    font-size: 0.9em;
    display:inline-block; width:80px; text-align:center;
}


/* Login Page Specifics */
.login-container {
    width: 100%;
    max-width: 400px; /* Slightly wider */
    margin: 80px auto;
    padding: 30px 35px; /* More padding */
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    text-align: center;
}
.login-container h2 {
    font-size: 1.8em;
    color: #2c3e50;
    margin-bottom: 10px;
}
.login-container p:not(.error-message):not(.message) {
    color: #7f8c8d;
    margin-bottom: 25px;
}
.login-form .form-group {
    margin-bottom: 18px; /* More space */
    text-align: left;
}
.login-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #495057;
}
.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    padding: 12px; /* More padding */
    border: 1px solid #ced4da;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 1em;
}
.login-form .button.button-primary { /* Ensure specific button styling for login */
    width: 100%;
    padding: 12px;
    font-size: 1.05em; /* Slightly larger */
    margin-top: 10px;
}

.login-container .back-to-site {
    margin-top: 25px;
    font-size: 0.9em;
}
.login-container .back-to-site a {
    color: #007bff;
    text-decoration: none;
}
.login-container .back-to-site a:hover {
    text-decoration: underline;
}

/* Dashboard Widgets Styling */
.dashboard-widgets {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px; /* Increased gap */
    margin-top: 25px;
}
.widget {
    background-color: #f8f9fa; /* Light background for widgets */
    padding: 20px 25px; /* More padding */
    border-radius: 6px;
    border: 1px solid #e9ecef; /* Slightly darker border */
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.widget h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 1.3em; /* Slightly larger */
    color: #34495e;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 10px;
}
.widget ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.widget ul li {
    margin-bottom: 10px; /* More spacing */
}
.widget ul li a:not(.button) { /* Style non-button links in widgets */
    text-decoration: none;
    color: #007bff;
    font-weight: 500;
}
.widget ul li a:not(.button):hover {
    text-decoration: underline;
    color: #0056b3;
}
.widget p {
    font-size: 1em;
    color: #495057;
}
.widget p strong {
    color: #343a40;
}


/* Pagination Styling */
.pagination {
    margin-top: 30px; /* More space above pagination */
    text-align: center;
    padding-bottom: 10px; /* Space below pagination */
}
.pagination .button, .pagination span.disabled  {
    margin: 0 4px; /* Spacing between page buttons */
    padding: 8px 14px; /* Comfortable padding */
    font-size: 0.9em;
    background-color: #fff;
    color: #007bff; /* Blue text */
    border: 1px solid #dee2e6; /* Light grey border */
}
.pagination .button:hover {
    background-color: #e9ecef; /* Light hover */
    color: #0056b3; /* Darker blue text on hover */
    border-color: #adb5bd;
}
.pagination .button.active {
    background-color: #007bff; /* Blue for active page */
    color: #fff;
    border-color: #007bff;
    cursor: default; /* Not clickable */
    z-index: 2; /* Bring active page to front if overlapping */
}
.pagination .button.active:hover {
    background-color: #007bff; /* Keep active style on hover */
    border-color: #007bff;
}
.pagination span.disabled { /* For '...' */
    color: #6c757d;
    background-color: transparent;
    border: none;
    padding: 8px 6px;
}


/* Responsive adjustments for admin area */
@media (max-width: 768px) {
    .admin-header {
        flex-direction: column;
        padding: 15px; /* Consistent padding */
    }
    .admin-header h1 { margin-bottom: 10px; text-align:center; }
    .admin-header .user-info { width: 100%; justify-content: space-between; margin-top:10px; }

    .admin-nav ul {
        flex-direction: column; /* Stack nav items */
    }
    .admin-nav ul li a {
        text-align: center; /* Center text in stacked nav */
        border-bottom: 1px solid #40586f; /* Separator for stacked items */
    }
    .admin-nav ul li:last-child a { border-bottom: none; }

    .admin-content { margin: 15px; padding: 20px; } /* Reduce margin/padding */
    .admin-content h2 { font-size: 1.6em; }

    .content-table { font-size: 0.85em; display: block; overflow-x: auto; white-space: nowrap; } /* Allow horizontal scroll */
    .content-table th, .content-table td { padding: 8px 10px; }
    .content-table .actions .button { display: inline-block; margin-bottom: 0; width: auto; margin-right: 5px; } /* Keep buttons inline but allow wrapping */
    .content-table .actions .button:last-child { margin-right: 0; }
}

@media (max-width: 480px) {
    .admin-header h1 { font-size: 1.3em; }
    .admin-header .user-info span { display:none; } /* Hide username text on very small screens */
    .login-container { margin: 40px 15px; padding: 20px; } /* Adjust login for small screens */
    .pagination .button, .pagination span.disabled { padding: 6px 10px; font-size: 0.85em; } /* Smaller pagination buttons */
    .admin-content { margin: 10px; padding: 15px; }
}