/**
 * GreenMetrics Email Reporting Styles
 */

/* Tab-specific styles for Email Reporting */
.greenmetrics-tab-content {
    padding: 20px 0;
}

.greenmetrics-tab-content.active {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Email Reports Section */
.email-reports-section .greenmetrics-admin-card {
    margin-top: 0;
}

.email-reports-section h2 {
    display: flex;
    align-items: center;
}

/* Email History Tab - Full Width Layout */
#tab-history .greenmetrics-admin-content-wrapper {
    display: block; /* Override the grid layout */
    width: 100%;
}

#tab-history .greenmetrics-admin-section {
    width: 100%;
}

/* Report History Table */
.report-history-table-container {
    margin-top: 15px;
    overflow-x: auto;
    width: 100%;
}

.report-history-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.report-history-table th {
    text-align: left;
    padding: 10px;
    background-color: #f9f9f9;
    border-bottom: 1px solid #ddd;
}

.report-history-table td {
    padding: 12px 10px;
    vertical-align: middle;
    word-wrap: break-word; /* Allow text to wrap in cells */
}

/* Column widths for better layout */
.report-history-table th:nth-child(1),
.report-history-table td:nth-child(1) {
    width: 15%; /* Date column */
}

.report-history-table th:nth-child(2),
.report-history-table td:nth-child(2) {
    width: 10%; /* Type column */
}

.report-history-table th:nth-child(3),
.report-history-table td:nth-child(3) {
    width: 20%; /* Recipients column */
}

.report-history-table th:nth-child(4),
.report-history-table td:nth-child(4) {
    width: 35%; /* Subject column */
}

.report-history-table th:nth-child(5),
.report-history-table td:nth-child(5) {
    width: 10%; /* Status column */
}

.report-history-table th:nth-child(6),
.report-history-table td:nth-child(6) {
    width: 10%; /* Actions column */
}

.test-badge {
    display: inline-block;
    background-color: #f0f0f0;
    color: #666;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 5px;
    font-weight: normal;
}

.status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
}

.status-success {
    background-color: #f0f9eb;
    color: #46b450;
    border: 1px solid #c6e6b1;
}

.status-error {
    background-color: #fef0f0;
    color: #dc3232;
    border: 1px solid #fac4c4;
}

.view-report {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f9fa;
    color: #2271b1;
    border-color: #ddd;
    transition: all 0.2s ease;
}

.view-report:hover {
    background-color: #f0f0f1;
    color: #135e96;
    border-color: #c3c4c7;
}

.view-report .dashicons {
    font-size: 16px;
    height: 16px;
    width: 16px;
    vertical-align: middle;
    margin-right: 3px;
}



.no-reports-message {
    background: #f8f9fa;
    border-left: 4px solid #2271b1;
    padding: 20px;
    margin: 20px 0;
    border-radius: 0 4px 4px 0;
    color: #555;
    width: 100%;
    box-sizing: border-box;
    max-width: 800px;
}

.no-reports-message p {
    margin: 0 0 10px;
    font-size: 14px;
    line-height: 1.5;
}

.no-reports-message p:last-child {
    margin-bottom: 0;
}

.no-reports-message .button {
    margin-top: 15px;
    display: inline-flex;
    align-items: center;
    background-color: #2271b1;
    color: #fff;
    border-color: #135e96;
    padding: 6px 14px;
    height: auto;
    font-size: 14px;
}

.no-reports-message .button:hover {
    background-color: #135e96;
    color: #fff;
    border-color: #0a4b78;
}

.no-reports-message .dashicons {
    vertical-align: middle !important;
}

/* Report Modal */
.report-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}

.report-modal-content {
    position: relative;
    background-color: #fff;
    margin: 5% auto;
    padding: 0;
    width: 80%;
    max-width: 900px;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    animation: modalFadeIn 0.3s;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.report-modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10;
}

.report-modal-close:hover,
.report-modal-close:focus {
    color: #333;
    text-decoration: none;
}

#report-modal-body {
    padding: 25px;
    max-height: 80vh;
    overflow-y: auto;
}

/* Report Info Styling */
.report-info {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.report-info h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 20px;
    color: #23282d;
}

.report-info p {
    margin: 8px 0;
    line-height: 1.5;
}

/* Report Content Styling */
.report-content {
    margin-bottom: 25px;
}

.report-content h3 {
    margin-top: 0;
    font-size: 18px;
    color: #23282d;
    display: flex;
    align-items: center;
}

.report-content h3::before {
    content: "\f119";
    font-family: dashicons;
    font-size: 20px;
    margin-right: 8px;
    color: #2271b1;
}

#report-content-frame {
    width: 100%;
    min-height: 400px;
    max-height: 600px;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: height 0.3s ease;
    overflow-y: auto;
}

.report-actions {
    text-align: right;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

/* Pagination */
.tablenav {
    margin: 15px 0;
    display: flex;
    justify-content: flex-end;
}

.tablenav-pages {
    display: flex;
    align-items: center;
}

.displaying-num {
    margin-right: 15px;
    color: #666;
}

.pagination-links {
    display: flex;
    align-items: center;
}

.pagination-links a,
.pagination-links span {
    display: inline-block;
    min-width: 28px;
    height: 28px;
    margin: 0 3px;
    padding: 0 5px;
    text-align: center;
    line-height: 28px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 3px;
    text-decoration: none;
    color: #0073aa;
}

.pagination-links span.current {
    background-color: #0073aa;
    border-color: #006799;
    color: #fff;
    font-weight: 600;
}

/* Email Preview Container */
.email-preview-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
}

.email-preview-footer {
    text-align: center;
    padding: 20px 0;
    border-top: 1px solid #eee;
    margin-top: 15px;
    background-color: #f5f5f5;
    border-radius: 0 0 6px 6px;
}

#toggle-mobile-preview {
    height: 40px;
    line-height: 38px;
    padding: 0 24px;
    font-size: 14px;
    background-color: #333;
    color: white;
    border-color: #222;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

#toggle-mobile-preview:hover {
    background-color: #444;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

#toggle-mobile-preview:focus {
    box-shadow: 0 0 0 1px #fff, 0 0 0 3px #333;
    outline: none;
}

.email-preview-container {
    background-color: #f9f9f9;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-top: 15px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.email-preview-container:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.email-preview-header {
    background-color: #f0f0f0;
    border-bottom: 1px solid #ddd;
    padding: 15px;
}

.email-preview-subject,
.email-preview-recipients {
    margin-bottom: 8px;
    font-size: 14px;
}

.email-preview-subject strong,
.email-preview-recipients strong {
    display: inline-block;
    width: 70px;
    color: #555;
    font-weight: 600;
}

.email-preview-content {
    background-color: #fff;
    position: relative;
}

.email-preview-frame {
    width: 100%;
    height: 500px;
    max-height: 600px;
    border: none;
    border-radius: 0 0 4px 4px;
    transition: all 0.3s ease;
    overflow-y: auto;
}

/* Mobile preview mode */
.email-preview-frame.mobile-preview {
    width: 375px;
    height: 500px;
    max-height: 600px;
    margin: 0 auto;
    display: block;
    border: 12px solid #333;
    border-radius: 36px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow-y: auto;
}

/* Mobile device styling */
.email-preview-frame.mobile-preview::before {
    content: '';
    position: absolute;
    width: 60px;
    height: 5px;
    background: #222;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 0 0 4px 4px;
    z-index: 10;
}

.email-preview-frame.mobile-preview::after {
    content: '';
    position: absolute;
    width: 50px;
    height: 50px;
    background: #222;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: 50%;
    z-index: 10;
}

/* Test Email Section */
.test-email-section {
    margin-top: 20px;
}

.test-email-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-top: 15px;
}

.test-email-container .button-large {
    padding: 8px 20px;
    height: auto;
    font-size: 14px;
    min-width: 200px;
}

.test-email-result {
    margin-top: 15px;
    padding: 10px 15px;
    border-radius: 4px;
    display: none;
    font-weight: 500;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
}

.test-email-result.success {
    background-color: #f0f9eb;
    color: #46b450;
    border: 1px solid #c6e6b1;
    display: flex;
    align-items: center;
}

.test-email-result.success::before {
    content: "\f147";
    font-family: dashicons;
    font-size: 20px;
    margin-right: 10px;
    color: #46b450;
}

.test-email-result.error {
    background-color: #fef0f0;
    color: #dc3232;
    border: 1px solid #fac4c4;
    display: flex;
    align-items: center;
}

.test-email-result.error::before {
    content: "\f534";
    font-family: dashicons;
    font-size: 20px;
    margin-right: 10px;
    color: #dc3232;
}

/* Form Styling */
.email-settings-form .form-table th {
    width: 200px;
    padding: 20px 10px 20px 0;
}

.email-template-textarea {
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
    background-color: #1e1e1e;
    color: #d4d4d4;
    border: 1px solid #333;
    border-top-left-radius: 0;
    border-top-right-radius: 3px;
    border-bottom-left-radius: 3px;
    border-bottom-right-radius: 3px;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2);
    padding: 12px;
    transition: all 0.2s ease;
    position: relative;
    tab-size: 4;
    height: 150px;
    width: 100%;
    box-sizing: border-box;
    margin-top: 0;
    letter-spacing: 0.5px;
    word-spacing: 1px;
}

/* Add a subtle glow effect on focus */
.email-template-textarea:focus {
    border-color: #0073aa;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 115, 170, 0.3), 0 0 7px rgba(0, 115, 170, 0.1);
}

/* Add a file name tab above each textarea */
.template-content-container .form-table td {
    position: relative;
    padding-top: 25px !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

.template-content-container .form-table td::before {
    content: attr(data-filename);
    position: absolute;
    top: 0;
    left: 0;
    background: #252525;
    color: #eee;
    font-size: 12px;
    padding: 5px 15px;
    border-radius: 5px 5px 0 0;
    z-index: 1;
    font-family: Consolas, Monaco, monospace;
    border: 1px solid #333;
    border-bottom: none;
    margin-bottom: -1px;
}

/* Code editor styling */
.template-content-container .form-table {
    border-collapse: separate;
    border-spacing: 0 15px;
}

/* Code editor header */
.template-content-container h3 {
    position: relative;
    margin-bottom: 20px;
}

/* Template container */
.template-content-container {
    position: relative;
}

/* Syntax highlighting hints */
.email-template-textarea[id="email_reporting_header"] ::selection,
.email-template-textarea[id="email_reporting_footer"] ::selection {
    background-color: rgba(76, 175, 80, 0.4);
}

.email-template-textarea[id="email_reporting_css"] ::selection {
    background-color: rgba(0, 115, 170, 0.4);
}

/* No line numbers for now */

/* Add line numbers via JavaScript */
.template-content-container .wp-editor-wrap {
    position: relative;
}

.checkbox-label {
    margin-bottom: 8px;
    display: inline-block;
    padding: 3px 0;
}

/* Template Editor Styling */
.template-selector-container,
.template-colors-container,
.template-content-container {
    margin-bottom: 25px;
}

/* Tab Consistency Styles */
.greenmetrics-tabs-nav {
	margin-bottom: 20px;
}

.greenmetrics-tabs-list {
	background: #f0f0f1;
	border-bottom: 1px solid #ccc;
}

.greenmetrics-tab-item {
	background-color: #f0f0f1;
	border: none;
	margin: 0;
	margin-right: 5px;
	position: relative;
}

.greenmetrics-tab-item.active {
	background-color: #fff;
	color: #2271b1;
	border-top: 3px solid #2271b1;
	padding-top: 9px;
	border-bottom: none;
	margin-bottom: 0;
}

.greenmetrics-tab-item.active:after {
	content: "";
	position: absolute;
	bottom: -1px;
	left: 0;
	right: 0;
	height: 1px;
	background: #fff;
}

.greenmetrics-tab-item.active .dashicons {
	color: #2271b1;
}

.template-selector-container select {
    min-width: 200px;
}

.template-colors-container h3,
.template-content-container h3 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    font-size: 16px;
    color: #333;
    position: relative;
}

/* Icon is now added directly in the HTML */

.placeholder-toolbar {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    border: 1px solid #e5e5e5;
}

.placeholder-toolbar label {
    font-weight: 600;
    margin-right: 15px;
    display: block;
    margin-bottom: 5px;
    color: #23282d;
}

.placeholder-toolbar .description {
    margin-bottom: 10px;
    color: #666;
    font-style: italic;
}

.placeholder-buttons-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}

.placeholder-button-wrapper {
    position: relative;
}

.placeholder-button {
    font-family: Consolas, Monaco, monospace;
    font-size: 12px;
    padding: 6px 12px;
    height: auto;
    min-height: 0;
    line-height: 1.4;
    position: relative;
    transition: all 0.2s ease;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 3px;
    color: #333;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.placeholder-button:hover {
    background-color: #f0f0f1;
    border-color: #c3c4c7;
    color: #2271b1;
}

.placeholder-button.copied {
    background-color: #4CAF50;
    color: white;
    border-color: #43A047;
    position: relative;
}

.placeholder-button.copied::after {
    content: "Copied!";
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    white-space: nowrap;
    animation: fadeInOut 1.5s ease forwards;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

/* Add tooltip */
.placeholder-button-wrapper {
    position: relative;
}

.placeholder-button-wrapper::after {
    content: "Click to copy";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 5px 8px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 100;
}

.placeholder-button-wrapper::before {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #333;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 100;
}

.placeholder-button-wrapper:hover::after,
.placeholder-button-wrapper:hover::before {
    opacity: 1;
    visibility: visible;
    bottom: calc(100% + 5px);
}

/* Help Section */
.email-help-section h3 {
    margin: 1.5em 0 0.5em;
    font-size: 16px;
    color: #23282d;
}

.email-help-section p {
    margin: 0.5em 0 1em;
    line-height: 1.6;
}

.email-help-section ul {
    margin-left: 20px;
}

.email-help-section code {
    background: #f0f0f1;
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 13px;
}
div#wpfooter{
    position: relative!important;
}
/* Responsive Adjustments */
@media screen and (max-width: 782px) {
    .greenmetrics-admin-content-wrapper {
        display: block;
    }

    .greenmetrics-admin-settings-column,
    .greenmetrics-admin-info-column {
        width: 100%;
    }

    .email-preview-frame {
        height: 400px;
    }

    .email-preview-frame.mobile-preview {
        width: 320px;
        height: 568px;
    }

    .email-preview-subject strong,
    .email-preview-recipients strong {
        display: block;
        margin-bottom: 3px;
    }

    .placeholder-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .placeholder-toolbar label {
        margin-bottom: 10px;
    }

    .placeholder-buttons-container {
        width: 100%;
    }

    .email-preview-controls {
        flex-direction: column;
        align-items: flex-start;
    }

    .preview-info {
        margin-top: 10px;
    }

    /* Responsive table for Email History */
    .report-history-table {
        table-layout: auto;
    }

    /* Hide less important columns on small screens */
    .report-history-table th:nth-child(3),
    .report-history-table td:nth-child(3) {
        display: none; /* Hide Recipients column */
    }

    /* Adjust column widths for small screens */
    .report-history-table th:nth-child(1),
    .report-history-table td:nth-child(1) {
        width: 25%; /* Date column */
    }

    .report-history-table th:nth-child(2),
    .report-history-table td:nth-child(2) {
        width: 15%; /* Type column */
    }

    .report-history-table th:nth-child(4),
    .report-history-table td:nth-child(4) {
        width: 30%; /* Subject column */
    }

    .report-history-table th:nth-child(5),
    .report-history-table td:nth-child(5) {
        width: 15%; /* Status column */
    }

    .report-history-table th:nth-child(6),
    .report-history-table td:nth-child(6) {
        width: 15%; /* Actions column */
    }
}

/* Extra small screens */
@media screen and (max-width: 600px) {
    /* Further optimize table for very small screens */
    .report-history-table th:nth-child(4),
    .report-history-table td:nth-child(4) {
        display: none; /* Hide Subject column on very small screens */
    }

    .report-history-table th:nth-child(1),
    .report-history-table td:nth-child(1) {
        width: 35%; /* Date column */
    }

    .report-history-table th:nth-child(2),
    .report-history-table td:nth-child(2) {
        width: 25%; /* Type column */
    }

    .report-history-table th:nth-child(5),
    .report-history-table td:nth-child(5) {
        width: 20%; /* Status column */
    }

    .report-history-table th:nth-child(6),
    .report-history-table td:nth-child(6) {
        width: 20%; /* Actions column */
    }
}
