/**
 * TheSnakeInTheGrass.com - Main Stylesheet
 */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #e0e0e0;
    background: linear-gradient(135deg, #1a2f1a 0%, #0d1f0d 50%, #1a2f1a 100%);
    background-attachment: fixed;
    min-height: 100vh;
}

a {
    color: #5fbd5f;
    text-decoration: none;
}

a:hover {
    color: #7dd87d;
    text-decoration: underline;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: linear-gradient(135deg, #1a1d2e 0%, #16192a 100%);
    color: #fff;
    padding: 1.5rem 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6);
    border-bottom: 2px solid rgba(95, 189, 95, 0.3);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo img {
    max-height: 120px;
    height: auto;
}

.site-title {
    font-size: 1.8rem;
    color: #fff;
}

/* Navigation */
nav ul {
    list-style: none;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

nav a {
    display: inline-block;
    padding: 0.5rem 1rem;
    color: #e0e0e0;
    font-weight: 500;
    background: rgba(95, 189, 95, 0.15);
    border: 1px solid rgba(95, 189, 95, 0.3);
    border-radius: 6px;
    transition: all 0.2s ease;
    text-decoration: none;
}

nav a:hover {
    background: rgba(95, 189, 95, 0.25);
    border-color: rgba(95, 189, 95, 0.5);
    color: #5fbd5f;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(95, 189, 95, 0.2);
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    background: rgba(95, 189, 95, 0.2);
    border: 2px solid rgba(95, 189, 95, 0.4);
    color: #5fbd5f;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.mobile-menu-toggle:hover {
    background: rgba(95, 189, 95, 0.3);
    border-color: rgba(95, 189, 95, 0.6);
}

.mobile-menu-toggle::after {
    content: ' ▼';
    font-size: 0.8rem;
}

.mobile-menu-toggle.active::after {
    content: ' ▲';
}

/* Main Content Area */
main {
    min-height: calc(100vh - 200px);
    padding: 2rem 0;
}

.content-wrapper {
    display: flex;
    gap: 2rem;
}

/* Admin Panel Sidebar */
.admin-panel {
    width: 280px;
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    height: fit-content;
    position: sticky;
    top: 20px;
}

.admin-panel h2 {
    margin-bottom: 1rem;
    color: #2c5f2d;
    font-size: 1.2rem;
    border-bottom: 2px solid #2c5f2d;
    padding-bottom: 0.5rem;
}

.admin-panel ul {
    list-style: none;
}

.admin-panel li {
    margin: 0.5rem 0;
}

.admin-panel a {
    display: block;
    padding: 0.75rem 1rem;
    background-color: #f8f8f8;
    border-radius: 5px;
    transition: all 0.3s ease;
}

.admin-panel a:hover {
    background-color: #2c5f2d;
    color: #fff;
    text-decoration: none;
}

.admin-panel .view-toggle {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #ddd;
}

.admin-panel button {
    width: 100%;
    padding: 0.75rem;
    background-color: #4a9d4d;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background-color 0.3s ease;
}

.admin-panel button:hover {
    background-color: #2c5f2d;
}

/* Main Content */
.main-content {
    flex: 1;
    background: linear-gradient(135deg, #1e1e2e 0%, #1a1a2a 100%);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 30px rgba(0,0,0,0.5);
    border: 1px solid rgba(95, 189, 95, 0.2);
    color: #e0e0e0;
}

/* Full width content (no admin panel) */
.main-content.full-width {
    width: 100%;
}

.main-content h1,
.main-content h2,
.main-content h3 {
    color: #5fbd5f;
}

/* Login Form */
.login-container {
    max-width: 450px;
    margin: 3rem auto;
    background: linear-gradient(135deg, #1e1e2e 0%, #1a1a2a 100%);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 30px rgba(0,0,0,0.5);
    border: 2px solid rgba(95, 189, 95, 0.3);
}

.login-container h1 {
    margin-bottom: 2rem;
    color: #5fbd5f;
    text-align: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

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

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

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid rgba(95, 189, 95, 0.3);
    border-radius: 6px;
    font-size: 1rem;
    background: rgba(30, 30, 46, 0.6);
    color: #e0e0e0;
    transition: all 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: rgba(95, 189, 95, 0.8);
    box-shadow: 0 0 0 3px rgba(95, 189, 95, 0.2);
    background: rgba(30, 30, 46, 0.8);
}

.btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    background: linear-gradient(135deg, #5fbd5f 0%, #4a9d4d 100%);
    color: #1e1e2e;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(95, 189, 95, 0.3);
}

.btn:hover {
    background: linear-gradient(135deg, #7dd87d 0%, #5fbd5f 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(95, 189, 95, 0.4);
    text-decoration: none;
}

.btn-block {
    width: 100%;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1.5rem;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Panel Widths */
.panel {
    margin-bottom: 2rem;
}

.panel-full {
    width: 100%;
}

.panel-half {
    width: 50%;
    display: inline-block;
    vertical-align: top;
}

.panel-third {
    width: 33.333%;
    display: inline-block;
    vertical-align: top;
}

.panel-quarter {
    width: 25%;
    display: inline-block;
    vertical-align: top;
}

/* Tables */
table {
    background: rgba(30, 30, 46, 0.6);
    border-collapse: collapse;
}

table thead tr {
    background: linear-gradient(135deg, rgba(95, 189, 95, 0.3) 0%, rgba(95, 189, 95, 0.2) 100%);
}

table thead th {
    color: #1a1a1a !important;
    font-weight: 700;
    padding: 1rem 0.75rem !important;
    border-bottom: 2px solid rgba(95, 189, 95, 0.5) !important;
    background: rgba(95, 189, 95, 0.8) !important;
    text-align: left;
}

table tbody tr {
    border-bottom: 1px solid rgba(95, 189, 95, 0.2);
    transition: all 0.2s;
}

table tbody tr:hover {
    background: rgba(95, 189, 95, 0.1);
}

table tbody td {
    color: #e0e0e0 !important;
    padding: 0.75rem !important;
    border-bottom: 1px solid rgba(95, 189, 95, 0.15) !important;
}

table tbody td strong {
    color: #5fbd5f;
}

table tbody td small {
    color: #888 !important;
}

/* Footer */
footer {
    background-color: #1a1a1a;
    color: #fff;
    padding: 2rem 0;
    text-align: center;
    margin-top: 3rem;
}

/* Admin Form Improvements - Better Readability */
main .form-group label {
    color: #5fbd5f !important;
    font-weight: 600 !important;
    font-size: 1rem !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

main .form-group small {
    color: #b0b0b0 !important;
    font-size: 0.9rem;
}

main h1, main h2, main h3 {
    color: #e8e8e8 !important;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

main p {
    color: #c8c8c8 !important;
    margin: 0 0 1rem 0;
    line-height: 1.6;
}

/* Ensure proper spacing in all content areas */
.main-content p {
    margin: 0 0 1rem 0;
    line-height: 1.6;
}

.main-content ul,
.main-content ol {
    margin: 0 0 1rem 0;
    padding-left: 2rem;
    line-height: 1.6;
}

.main-content li {
    margin-bottom: 0.5rem;
}

.main-content h1,
.main-content h2,
.main-content h3,
.main-content h4,
.main-content h5,
.main-content h6 {
    margin: 1.5rem 0 1rem 0;
    line-height: 1.3;
}

/* Image alignment and spacing */
.main-content img {
    max-width: 100%;
    height: auto;
    margin: 1rem 0;
    border-radius: 4px;
}

.main-content img.align-left {
    float: left;
    margin: 0.5rem 1.5rem 1rem 0;
}

.main-content img.align-right {
    float: right;
    margin: 0.5rem 0 1rem 1.5rem;
}

.main-content img.align-center {
    display: block;
    margin: 1rem auto;
}

/* TinyMCE modals need to appear above panel editor (z-index: 9999) */
.tox-tinymce-aux,
.tox-dialog-wrap,
.tox-dialog,
.tox-dialog__backdrop,
.tox .tox-dialog-wrap__backdrop {
    z-index: 65535 !important;
}

/* TinyMCE green border styling */
.tox-tinymce {
    border: 2px solid rgba(95, 189, 95, 0.4) !important;
    border-radius: 8px !important;
}

.tox-tinymce:focus-within {
    border-color: rgba(95, 189, 95, 0.8) !important;
    box-shadow: 0 0 0 3px rgba(95, 189, 95, 0.2) !important;
}

/* TinyMCE dialog styling - green/black theme */
.tox .tox-dialog {
    background-color: #1e1e2e !important;
    border: 2px solid rgba(95, 189, 95, 0.4) !important;
    border-radius: 8px !important;
}

.tox .tox-dialog__header {
    background-color: #1a1a2a !important;
    border-bottom: 1px solid rgba(95, 189, 95, 0.3) !important;
    color: #5fbd5f !important;
}

.tox .tox-dialog__title {
    color: #5fbd5f !important;
    font-weight: 600 !important;
}

.tox .tox-dialog__body {
    background-color: #1e1e2e !important;
    color: #e0e0e0 !important;
}

.tox .tox-dialog__footer {
    background-color: #1a1a2a !important;
    border-top: 1px solid rgba(95, 189, 95, 0.3) !important;
}

.tox .tox-label,
.tox .tox-toolbar-label {
    color: #e0e0e0 !important;
}

.tox .tox-textfield,
.tox .tox-textarea,
.tox .tox-listboxfield .tox-listbox--select {
    background-color: rgba(30, 30, 46, 0.8) !important;
    border: 1px solid rgba(95, 189, 95, 0.4) !important;
    color: #e0e0e0 !important;
}

.tox .tox-textfield:focus,
.tox .tox-textarea:focus {
    border-color: rgba(95, 189, 95, 0.8) !important;
    box-shadow: 0 0 0 2px rgba(95, 189, 95, 0.2) !important;
}

.tox .tox-button {
    background-color: rgba(95, 189, 95, 0.2) !important;
    border: 1px solid rgba(95, 189, 95, 0.4) !important;
    color: #5fbd5f !important;
}

.tox .tox-button:hover {
    background-color: rgba(95, 189, 95, 0.3) !important;
    border-color: rgba(95, 189, 95, 0.6) !important;
}

.tox .tox-button--primary {
    background-color: #5fbd5f !important;
    border-color: #5fbd5f !important;
    color: #1e1e2e !important;
}

.tox .tox-button--primary:hover {
    background-color: #7dd87d !important;
    border-color: #7dd87d !important;
}

/* TinyMCE dropdown menus - fix z-index and styling */
.tox .tox-collection,
.tox .tox-menu {
    background-color: #1e1e2e !important;
    border: 1px solid rgba(95, 189, 95, 0.4) !important;
    z-index: 70000 !important;
}

.tox .tox-collection__item,
.tox .tox-menu__item {
    color: #e0e0e0 !important;
}

.tox .tox-collection__item--active,
.tox .tox-collection__item:hover {
    background-color: rgba(95, 189, 95, 0.2) !important;
    color: #5fbd5f !important;
}

/* TinyMCE selectbox dropdowns */
.tox .tox-selectfield select {
    background-color: rgba(30, 30, 46, 0.8) !important;
    border: 1px solid rgba(95, 189, 95, 0.4) !important;
    color: #e0e0e0 !important;
}

/* Ensure dropdown lists appear above everything */
.tox-tinymce-aux .tox-collection {
    z-index: 70000 !important;
}

/* Better input contrast */
main input[type="text"],
main input[type="email"],
main input[type="password"],
main input[type="number"],
main select {
    background: rgba(40, 40, 52, 0.8) !important;
    color: #e8e8e8 !important;
    border: 1px solid rgba(95, 189, 95, 0.4) !important;
}

main textarea {
    width: 100% !important;
    background: rgba(40, 40, 52, 0.8) !important;
    color: #e8e8e8 !important;
    border: 1px solid rgba(95, 189, 95, 0.4) !important;
    padding: 0.75rem !important;
    border-radius: 5px !important;
    font-family: inherit !important;
    font-size: 1rem !important;
    line-height: 1.5 !important;
}

main input[type="text"]::placeholder,
main input[type="email"]::placeholder,
main input[type="password"]::placeholder,
main textarea::placeholder {
    color: #888 !important;
}

/* Checkbox and radio labels */
main .form-group label input[type="checkbox"],
main .form-group label input[type="radio"] {
    margin-right: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    /* Typography adjustments */
    body {
        font-size: 15px;
    }

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    /* Header adjustments */
    header {
        padding: 1rem 0;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        position: relative;
    }

    nav {
        width: 100%;
        position: relative;
    }

    .logo img {
        max-height: 80px;
    }

    /* Navigation - mobile dropdown */
    .mobile-menu-toggle {
        display: block;
        width: 100%;
    }

    nav ul {
        display: none;
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
        margin-top: 1rem;
        background: linear-gradient(135deg, rgba(30, 30, 46, 0.95) 0%, rgba(26, 26, 42, 0.95) 100%);
        border: 2px solid rgba(95, 189, 95, 0.3);
        border-radius: 8px;
        padding: 1rem;
        position: absolute;
        left: 0;
        right: 0;
        z-index: 1000;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    }

    nav ul.active {
        display: flex;
    }

    nav li {
        width: 100%;
    }

    nav a {
        display: block;
        padding: 0.875rem 1rem;
        width: 100%;
        text-align: left;
    }

    /* Main content */
    .container {
        padding: 0 15px;
    }

    main {
        padding: 1.5rem 0;
    }

    .content-wrapper {
        flex-direction: column;
    }

    .admin-panel {
        width: 100%;
        position: static;
        margin-bottom: 1.5rem;
    }

    .main-content {
        padding: 1.5rem;
    }

    /* Panels - all full width on mobile */
    .panel-half,
    .panel-third,
    .panel-quarter {
        width: 100%;
    }

    /* Article/Post cards - 3 columns on mobile */
    .articles-grid,
    .posts-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.5rem !important;
    }

    /* Smaller text in cards for mobile */
    .article-card h3,
    .post-card h3 {
        font-size: 0.85rem !important;
        margin: 0 0 0.5rem 0 !important;
    }

    .article-card p,
    .post-card p {
        font-size: 0.75rem !important;
        line-height: 1.4 !important;
    }

    .article-card,
    .post-card {
        font-size: 0.75rem !important;
    }

    .article-card > div,
    .post-card > div {
        padding: 0.75rem !important;
    }

    /* Login container */
    .login-container {
        margin: 1.5rem auto;
        padding: 1.5rem;
    }

    /* Tables - scrollable on mobile */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        font-size: 0.9rem;
    }

    table thead th,
    table tbody td {
        padding: 0.5rem !important;
        font-size: 0.85rem;
    }

    /* Buttons - full width on mobile */
    .btn {
        padding: 0.875rem 1.5rem;
        font-size: 0.95rem;
    }

    .btn-block {
        width: 100%;
    }

    /* Form adjustments */
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Admin panel editor modal */
    .panel-edit-content {
        width: 95%;
        padding: 1.5rem;
        max-height: 85vh;
    }

    /* Category selector */
    .category-selector {
        font-size: 0.9rem;
    }

    .category-dropdown {
        max-height: 200px;
    }

    /* Visual panel container */
    .visual-panel {
        padding: 0.75rem;
    }

    .panel-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .panel-actions {
        width: 100%;
        justify-content: space-between;
    }

    /* Footer */
    footer {
        padding: 1.5rem 0;
        font-size: 0.9rem;
    }

    /* TinyMCE adjustments */
    .tox-tinymce {
        height: 300px !important;
    }

    /* Alerts */
    .alert {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    /* Image previews */
    #featured-image-preview img {
        max-width: 200px;
        max-height: 150px;
    }
}

/* Extra small devices (phones in portrait, less than 576px) */
@media (max-width: 575px) {
    .container {
        padding: 0 10px;
    }

    .main-content {
        padding: 1rem;
        border-radius: 8px;
    }

    .login-container {
        padding: 1.25rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    .logo img {
        max-height: 60px;
    }

    /* Keep 3 columns on small screens */
    .articles-grid,
    .posts-grid {
        gap: 0.4rem !important;
    }

    .article-card h3,
    .post-card h3 {
        font-size: 0.8rem !important;
    }

    .article-card p,
    .post-card p {
        font-size: 0.7rem !important;
    }

    .article-card > div,
    .post-card > div {
        padding: 0.5rem !important;
    }

    /* Stack everything on very small screens */
    .panel-width-selector,
    .panel-btn {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
    }
}

/* Tablet landscape and small desktops */
@media (min-width: 769px) and (max-width: 1024px) {
    .container {
        max-width: 900px;
    }

    .articles-grid,
    .posts-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .admin-panel {
        width: 240px;
    }
}
