/**
 * EcoClub Stations V2 - Admin Styles
 */

/* Frontend shortcode styles - extracted from theme */
:root {
    --primary-green: #4BAE3A;
    --secondary-green: #92d14f;
    --orange: #ff9500;
    --yellow: #ffff01;
    --blue: #6d9eeb;
}

.primary-green {
    background-color: var(--primary-green);
}

.orange {
    background-color: var(--orange);
}

.yellow {
    background-color: var(--yellow);
}

.blue {
    background-color: var(--blue);
}

/* Data container and grid styles for stations */
.data-total-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
    margin-bottom: 2rem;
}

.data-total-title {
    font-size: 2rem; 
    flex: 0 0 60%;
    text-transform: uppercase;
}

.data-total-number {
    color: #4bad3b;
    font-size: 3rem;
    font-weight: 700;
    text-align: right;
    width: 40%;
}

/* Стилі для полоски */
.data-total-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: #eeeeee;
    margin-top: 2rem;
}

/* Header-3 styles */
.header-3 {
    margin-top: 50px;
    font-size: 30px;
    font-weight: 700;
}

/* Media queries for responsive design */
@media screen and (max-width: 768px) {
    .data-total-number {
        font-size: 2rem;
    }
    
    .header-3 {
        margin-top: 30px;
        font-size: 30px;
    }
}

.data-total-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: #eeeeee;
    margin-top: 2rem;
}

.data-container {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    max-height: 500px;
    overflow: auto;
    padding-right: 15px;
    position: relative;
}

/* Sticky header for table */
.data-container .data-row:first-child {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #fff;
}

.data-container.full-height {
    max-height: 100%;
}

.data-container.full-height .data-cell {
    flex: 0 0 calc(13% - 0.2rem);
}

.data-container.full-height .data-cell:first-child {
    flex: 0 0 calc(20% - 0.2rem);
}

.data-container.full-height.column-three .data-cell {
    flex: 0 0 calc(35% - 0.2rem);
}

.data-container.full-height.column-three .data-cell:first-child {
    flex: 0 0 calc(30% - 0.2rem);
}

.data-container.full-height .data-cell.primary-green {
    background-color: var(--primary-green);
}

.data-container.full-height .data-cell.orange {
    background-color: var(--orange);
}

.data-container.full-height .data-cell.yellow {
    background-color: var(--yellow);
    color: black;
}

.data-container.full-height .data-cell.blue {
    background-color: var(--blue);
}

.data-row {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    border-bottom: 2px solid white;
}

/* Sticky header for table */
.data-row:first-child {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: white;
}

.data-cell {
    flex: 0 0 calc(15% - 0.2rem);
    margin-left: 0.2rem;
    padding: 1rem 0.5rem;
    background-color: #eeeeee;
    color: #000000;
    text-align: center;
    align-items: center;
    display: flex;
    justify-content: center;
}

.data-cell:first-child {
    flex: 0 0 calc(20% - 0.2rem);
    margin-left: 0;
}

.data-cell.title {
    background-color: #dddddd;
    font-weight: bold;
}

/* Clickable elements for modal */
.clickable {
    cursor: pointer;
}

/* Modal styles */
.modal,
.ecoclub-v2-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.ecoclub-v2-modal-content {
    position: relative;
    background-color: #ffffff;
    padding: 20px;
    border-radius: 5px;
    width: 90%;
    height: 90%;
    max-width: 1400px;
    max-height: 900px;
    margin: auto;
    top: 50%;
    transform: translateY(-50%);
}

.ecoclub-v2-modal-content iframe {
    width: 100%;
    height: calc(100% - 50px);
    border: 0;
}

.ecoclub-v2-close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 0;
    cursor: pointer;
    font-size: 20px;
    font-weight: 400;
    line-height: 1;
    z-index: 10000;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.ecoclub-v2-close-modal:hover {
    background: #5a6268;
}

/* Stations page input styles */
.ecoclub-input-wide {
    width: 100%;
    max-width: 420px;
}

.ecoclub-input-mid {
    width: 100%;
    max-width: 220px;
}

.ecoclub-input-small {
    width: 120px;
}

/* Table improvements */
.ecoclub-table-wrapper {
    overflow-x: visible;
    margin: 15px 0;
}

/* Flex table structure */
.ecoclub-flex-table {
    display: flex;
    flex-direction: column;
    width: 100%;
    background: #fff;
    border: 1px solid #c3c4c7;
}

/* Вертикальна колонка з назвами */
.ecoclub-title-cell {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px;
    align-items: stretch !important;
}

.ecoclub-api-title {
    font-size: 13px;
    font-weight: 500;
    color: #2c3338;
    word-wrap: break-word;
}

.ecoclub-input-with-label {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ecoclub-input-label {
    font-size: 11px;
    font-weight: 600;
    color: #646970;
    min-width: 28px;
}

.ecoclub-title-cell input {
    width: 100% !important;
    font-size: 12px;
}

/* Вертикальна колонка з потужністю */
.ecoclub-power-cell {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px;
    align-items: stretch !important;
}

.ecoclub-api-power {
    font-size: 12px;
    font-weight: 500;
    color: #2c3338;
}

.ecoclub-power-cell input {
    width: 100% !important;
    font-size: 12px;
}

.ecoclub-flex-row {
    display: flex;
    border-bottom: 1px solid #c3c4c7;
    position: relative;
}

.ecoclub-flex-row:last-child {
    border-bottom: none;
}

.ecoclub-flex-header {
    background: #f0f0f1;
    font-weight: 600;
    border-bottom: 2px solid #c3c4c7;
}

.ecoclub-flex-body {
    display: flex;
    flex-direction: column;
}

.ecoclub-flex-body .ecoclub-flex-row:nth-child(even) {
    background: #f6f7f7;
}

.ecoclub-flex-body .ecoclub-flex-row:hover {
    background: #f0f0f1;
}

.ecoclub-flex-cell {
    padding: 8px 10px;
    border-right: 1px solid #c3c4c7;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    overflow-wrap: break-word;
    word-wrap: break-word;
    min-width: 0;
}

.ecoclub-flex-cell:last-child {
    border-right: none;
}

.ecoclub-flex-cell input[type="text"] {
    width: 100%;
}

.ecoclub-flex-cell button {
    width: auto;
}

/* Row state styles */
.ecoclub-flex-row.ecoclub-station-inactive {
    opacity: 0.6;
    background-color: #f9f9f9;
}

.ecoclub-flex-row.ecoclub-station-inactive .ecoclub-flex-cell {
    color: #666;
}

.ecoclub-flex-row.ecoclub-station-combined {
    background-color: #fff8e5;
}

.ecoclub-flex-row.ecoclub-station-combined::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #d63638;
}

.ecoclub-flex-row.ecoclub-station-combined .ecoclub-flex-cell {
    color: #555;
}

.ecoclub-flex-row.ecoclub-station-combined.ecoclub-station-inactive {
    background-color: #fff8e5;
    opacity: 0.7;
}

.ecoclub-flex-row.ecoclub-station-combined .ecoclub-flex-cell input[readonly],
.ecoclub-flex-row.ecoclub-station-combined .ecoclub-flex-cell button[disabled] {
    background-color: #fafafa !important;
    cursor: not-allowed !important;
    opacity: 0.6;
}

.ecoclub-flex-row.ecoclub-station-combined .ecoclub-toggle-switch input[disabled] + .ecoclub-slider {
    cursor: not-allowed;
    opacity: 0.5;
}

table.widefat td {
    vertical-align: middle;
}

table.widefat th {
    white-space: nowrap;
}

/* Readonly fields styling */
.ecoclub-inverter-ids[readonly] {
    background-color: #f7f7f7;
    color: #666;
    cursor: not-allowed;
}

/* Toggle switch styles */
.ecoclub-toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
    flex-shrink: 0;
}

.ecoclub-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ecoclub-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .3s;
    border-radius: 24px;
}

.ecoclub-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .ecoclub-slider {
    background-color: #46b450;
}

input:checked + .ecoclub-slider:before {
    transform: translateX(26px);
}

.ecoclub-slider:hover {
    box-shadow: 0 0 2px rgba(0,0,0,0.3);
}

/* Inactive station styling */
tr.ecoclub-station-inactive {
    opacity: 0.6;
    background-color: #f9f9f9;
}

tr.ecoclub-station-inactive td {
    color: #666;
}

/* Combined station styling */
tr.ecoclub-station-combined {
    background-color: #fff8e5;
    border-left: 3px solid #d63638;
}

tr.ecoclub-station-combined td {
    color: #555;
}

/* Combined + Inactive station (both classes) */
tr.ecoclub-station-combined.ecoclub-station-inactive {
    background-color: #fff8e5;
    opacity: 0.7;
}

tr.ecoclub-station-combined input[readonly],
tr.ecoclub-station-combined button[disabled] {
    background-color: #fafafa !important;
    cursor: not-allowed !important;
    opacity: 0.6;
}

tr.ecoclub-station-combined .ecoclub-toggle-switch input[disabled] + .ecoclub-slider {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Loading states */
.ecoclub-v2-loading-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
}

.ecoclub-v2-status {
    display: none;
    font-weight: 600;
    color: #0073aa;
}

.ecoclub-v2-status.active {
    display: inline;
}

/* Button states */
.ecoclub-save.saving {
    opacity: 0.7;
    pointer-events: none;
}

/* Form improvements */
.ecoclub-form-section {
    margin-bottom: 25px;
}

.ecoclub-form-section h3 {
    margin-bottom: 15px;
    color: #23282d;
}

/* Notice improvements */
.ecoclub-notice-area .notice {
    margin: 5px 0 15px 0;
}

/* Responsive adjustments */
@media screen and (max-width: 782px) {
    .ecoclub-input-wide,
    .ecoclub-input-mid {
        max-width: 100%;
    }
    
    .ecoclub-v2-loading-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
}

/* Accessibility improvements */
.ecoclub-save:focus {
    box-shadow: 0 0 0 2px #0073aa;
    outline: 2px solid transparent;
}

/* Success states */
.ecoclub-success-feedback {
    color: #46b450;
    font-weight: 600;
}

.ecoclub-error-feedback {
    color: #dc3232;
    font-weight: 600;
}

/* Sort buttons styled like toggles */
.ecoclub-flex-cell .ecoclub-sort-btn {
    width: 24px !important;
    height: 48px;
    border-radius: 5px;
    border: 1px solid #ddd;
    background: #f7f7f7;
    color: #555;
    font-size: 28px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    padding: 0;
    font-family: inherit;
    position: relative;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.ecoclub-flex-cell .ecoclub-sort-btn:hover {
    background: #0073aa;
    color: white;
    border-color: #005a87;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transform: translateY(-1px);
}

.ecoclub-flex-cell .ecoclub-sort-btn:active {
    transform: translateY(0) scale(0.95);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.ecoclub-flex-cell .ecoclub-sort-btn:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}