/* app/static/main.css */

/* General Body and Layout */
body {
    font-family: Inter, sans-serif;
    background-color: #0F172A; /* Dark blue-gray background */
    color: #E2E8F0; /* Light text color */
    margin: 0;
}

.dashboard-container {
    display: flex;
    padding: 20px;
    gap: 20px;
    height: calc(100vh - 100px); /* Adjust based on nav height */
}

/* Left and Right Panels */
.left-panel, .right-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.left-panel {
    flex: 1; /* Takes 1/3 of space */
}

.right-panel {
    flex: 2; /* Takes 2/3 of space */
}

/* Card Style for Panels */
.card {
    background-color: #1E293B; /* Darker card background */
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.card-title {
    font-size: 1.25rem; /* 20px */
    font-weight: 600;
    margin-bottom: 16px;
    color: #CBD5E1;
}

/* Form Styles */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: #94A3B8;
}

.form-group input, .form-group select {
    width: 100%;
    padding: 10px;
    background-color: #334155;
    border: 1px solid #475569;
    border-radius: 8px;
    color: #E2E8F0;
    font-size: 1rem;
    box-sizing: border-box; /* Important for padding and width */
}

.form-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem; /* 14px */
}

thead {
    background-color: #334155;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #334155;
}

tbody tr:hover {
    background-color: #334155;
}

/* Button Styles */
.btn {
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.875rem;
}

.btn-primary {
    background-color: #2563EB;
    color: white;
}
.btn-primary:hover {
    background-color: #1D4ED8;
}

.btn-secondary {
    background-color: #475569;
    color: white;
}
.btn-secondary:hover {
    background-color: #64748B;
}

/* Specific button styles for actions */
.btn-start { background-color: #16A34A; color: white; }
.btn-stop { background-color: #DC2626; color: white; }
.btn-edit { background-color: #64748B; color: white; }
.btn-delete { background-color: #991B1B; color: white; }

/* === Checkbox Enhancement Styles === */

.form-group label {
    /* این خط را به استایل لیبل اضافه یا ویرایش کنید */
    vertical-align: middle; /* باعث می‌شود لیبل‌ها با ورودی‌ها هم‌تراز شوند */
}

/* استایل‌های جدید برای چک‌باکس‌ها */
.form-group input[type="checkbox"] {
    /* اندازه چک‌باکس را بزرگتر می‌کنیم */
    width: 18px;
    height: 18px;
    /* هم‌ترازی عمودی با متن کنارش */
    vertical-align: middle;
    margin-right: 8px; /* کمی فاصله بین چک‌باکس و لیبل */
    cursor: pointer;
}

/* استایل برای والد چک‌باکس و لیبل آن تا در یک خط باشند */
.checkbox-wrapper {
    display: flex;
    align-items: center; /* کلید هم‌ترازی عمودی */
    padding-top: 5px; /* کمی فاصله از بالا */
}

/* ================================================================== */
/* ===         NEW & SAFE RESPONSIVE STYLES (25 May 2024)         === */
/* ================================================================== */

/* 
 * This helper class stacks flex items vertically on smaller screens.
 * It will be applied to containers like the one in the bot pages.
*/
@media (max-width: 1024px) {
    .responsive-stack-container {
        flex-direction: column;
        height: auto; /* Allow vertical growth */
    }
}

/* 
 * This helper class makes a grid container single-column on smaller screens.
 * It will be applied to containers on the dashboard and admin settings.
*/
@media (max-width: 1024px) {
    .responsive-single-column-grid {
        grid-template-columns: 1fr;
    }
}

/* 
 * This helper class makes wide tables horizontally scrollable on mobile.
 * It will be applied to the div wrapping a table.
*/
@media (max-width: 768px) {
    .responsive-mobile-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .responsive-mobile-table-container table {
        width: auto;
        white-space: nowrap;
    }
}

/* 
 * This helper class stacks form elements vertically on mobile.
 * It will be applied to the parent div of a form row.
*/
@media (max-width: 768px) {
    .responsive-form-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    .responsive-form-row label {
        text-align: left;
        flex-basis: auto;
        margin-bottom: 5px;
    }
}

/* ================================================================== */
/* ===         FINAL RESPONSIVE STYLES (Desktop-First)          === */
/* ================================================================== */

/*
 * Styles for tablets (e.g., iPads in portrait mode) and smaller.
 * Breakpoint: 1024px
*/
@media (max-width: 1024px) {
    .dashboard-container {
        flex-direction: column;
        height: auto;
        padding: 15px;
    }

    .left-panel, .right-panel {
        flex: 1 1 100%;
    }
}

/*
 * Styles for mobile devices.
 * Breakpoint: 768px
*/
@media (max-width: 768px) {
    .main-content {
        padding: 10px;
    }

    .card {
        padding: 15px;
    }

    .form-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .form-row label {
        text-align: left;
        margin-bottom: 5px;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-container table {
        width: auto;
        white-space: nowrap;
    }
}


/* ================================================================== */
/* ===   NEW RESPONSIVE STYLES FOR DOCS/DYNAMIC PAGES (Mobile)  === */
/* ================================================================== */

@media (max-width: 1024px) {
    .docs-layout {
        flex-direction: column;
    }

    .docs-sidebar {
        position: static;
        width: 100%;
        height: auto;
        margin-bottom: 20px;
        overflow-y: visible;
        top: unset; /* Remove sticky positioning */
    }

    .docs-content section {
        padding-top: 20px;
        margin-top: 0;
    }
}

/* ================================================================== */
/* ===         CHOICES.JS DARK THEME OVERRIDES                  === */
/* ================================================================== */

/* Main input field appearance */
.form-group .choices__inner {
    background-color: #334155 !important;
    border: 1px solid #475569 !important;
    color: #E2E8F0 !important;
    padding: 10px !important;
    font-size: 1rem !important;
    min-height: auto !important;
}

/* The dropdown list itself - FIX FOR WHITE BACKGROUND */
.form-group .choices__list--dropdown, 
.form-group .choices__list[aria-expanded] {
    background-color: #1E293B !important;
    border: 1px solid #475569 !important;
    color: #E2E8F0 !important;
}

/* Search input field inside the dropdown */
.form-group .choices__input {
    background-color: transparent !important;
    color: #E2E8F0 !important;
}

/* An item in the dropdown list */
.form-group .choices__item--choice {
    color: #E2E8F0 !important;
}

/* The highlighted item when hovering - FIX FOR RED HIGHLIGHT */
.form-group .choices__list--dropdown .choices__item--selectable.is-highlighted,
.form-group .choices__list[aria-expanded] .choices__item--selectable.is-highlighted {
    background-color: #2563EB !important; /* Your primary blue color */
    color: white !important;
}

/* The dropdown arrow */
.form-group .choices[data-type*="select-one"]::after {
    border-color: #E2E8F0 transparent transparent !important;
}

.form-group .choices[data-type*="select-one"].is-open::after {
    border-color: transparent transparent #E2E8F0 !important;
}