/* Plugin0 Admin Styles */

/* Dashboard Cards */
.plugin0-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.plugin0-card {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    box-shadow: 0 1px 1px rgba(0, 0, 0, .04);
}

.plugin0-card h2 {
    margin-top: 0;
    margin-bottom: 15px;
    font-size: 16px;
    color: #23282d;
}

/* Connection Status */
.plugin0-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.plugin0-status.connected {
    color: #00a32a;
}

.plugin0-status.disconnected {
    color: #d63638;
}

.plugin0-status .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.plugin0-status p {
    margin: 0;
    font-weight: 500;
}

/* Stats */
.plugin0-stats {
    display: flex;
    gap: 30px;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 32px;
    font-weight: bold;
    color: #0073aa;
    line-height: 1;
    margin-bottom: 5px;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: #646970;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Steps */
.plugin0-steps {
    margin: 0;
    padding-left: 20px;
}

.plugin0-steps li {
    margin-bottom: 15px;
}

.plugin0-steps strong {
    color: #0073aa;
}

.plugin0-steps p {
    margin: 5px 0 0 0;
    color: #646970;
}

/* Recent Codes */
.plugin0-recent-codes .code-item {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f1;
}

.plugin0-recent-codes .code-item:last-child {
    border-bottom: none;
}

.plugin0-recent-codes h4 {
    margin: 0 0 5px 0;
    font-size: 14px;
    color: #0073aa;
}

.plugin0-recent-codes p {
    margin: 0 0 8px 0;
    color: #646970;
    font-size: 13px;
}

.code-type {
    display: inline-block;
    background: #0073aa;
    color: white;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    text-transform: uppercase;
    margin-right: 10px;
}

.code-date {
    font-size: 12px;
    color: #646970;
}

/* Code Library Page */
.plugin0-codes-page {
    margin-top: 20px;
}

.plugin0-empty-state {
    text-align: center;
    padding: 60px 20px;
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
}

.plugin0-empty-icon .dashicons {
    font-size: 64px;
    width: 64px;
    height: 64px;
    color: #c3c4c7;
    margin-bottom: 20px;
}

.plugin0-empty-state h2 {
    margin: 0 0 10px 0;
    color: #23282d;
}

.plugin0-codes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
}

.plugin0-codes-header p {
    margin: 0;
    color: #646970;
}

/* Code Types */
.plugin0-code-type {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    transition: opacity 0.2s ease;
}

.plugin0-code-type:hover {
    opacity: 0.8;
}

.plugin0-type-javascript {
    background: #f7df1e;
    color: #000;
}

.plugin0-type-php {
    background: #777bb4;
    color: white;
}

.plugin0-type-css {
    background: #1572b6;
    color: white;
}

.plugin0-type-html {
    background: #e34f26;
    color: white;
}

.plugin0-type-snippet {
    background: #646970;
    color: white;
}

/* File Information */
.plugin0-file-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.plugin0-file-info .file-extension {
    display: inline-block;
    background: #f0f0f1;
    color: #50575e;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    font-family: monospace;
}

.plugin0-file-info .file-size {
    font-size: 12px;
    color: #646970;
}

/* Code Actions */
.plugin0-code-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.plugin0-code-actions .button {
    font-size: 12px;
    height: auto;
    padding: 4px 8px;
}

/* Loading State */
#plugin0-code-loading {
    text-align: center;
    padding: 20px;
    color: #646970;
    font-style: italic;
}

#plugin0-code-loading p {
    margin: 0;
}

/* Table Column Widths */
.wp-list-table .column-title {
    width: 20%;
}

.plugin0-codes-page .wp-list-table .column-description {
    width: 25%;
}

.wp-list-table .column-type {
    width: 8%;
}

.wp-list-table .column-status {
    width: 8%;
}

.wp-list-table .column-execution {
    width: 10%;
}

.wp-list-table .column-file {
    width: 10%;
}

.wp-list-table .column-date {
    width: 12%;
}

.wp-list-table .column-actions {
    width: 7%;
}

/* Snippet Status */
.plugin0-code-status,
.plugin0-status-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.plugin0-status-active,
.plugin0-status-badge.active {
    background: #d1e7dd;
    color: #0f5132;
    border: 1px solid #a3cfbb;
}

.plugin0-status-inactive,
.plugin0-status-badge.inactive {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f1aeb5;
}

.plugin0-code-status {
    transition: all 0.2s ease;
    cursor: pointer;
}

.plugin0-code-status:hover {
    opacity: 0.8;
    transform: scale(1.05);
}

/* Execution Location */
.plugin0-code-execution,
.plugin0-execution-location {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    background: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
}

/* Modal */
.plugin0-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.plugin0-modal-content {
    background: white;
    border-radius: 4px;
    max-width: 800px;
    width: 90%;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.plugin0-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #ddd;
}

.plugin0-modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.plugin0-modal-header .plugin0-modal-close {
    width: 30px;
}

.plugin0-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.plugin0-modal-close:hover {
    color: #000;
}

.plugin0-modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.plugin0-code-container {
    margin-top: 15px;
}

.plugin0-code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px 4px 0 0;
    border: 1px solid #ddd;
    border-bottom: none;
}

.plugin0-code-container pre {
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 0 0 4px 4px;
    padding: 15px;
    margin: 0;
    overflow-x: auto;
    font-family: 'Monaco', 'Consolas', monospace;
    font-size: 13px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Settings Page */
.plugin0-settings-page {
    margin-top: 20px;
}

.plugin0-settings-header .notice {
    display: none !important;
}

/* Webhook URL buttons */
#copy-webhook-url,
#refresh-webhook-url {
    margin-left: 5px;
}

#refresh-webhook-url {
    margin-left: 5px;
}

.plugin0-connection-section {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 30px;
}

.plugin0-connection-section h2 {
    margin-top: 0;
    margin-bottom: 20px;
    font-size: 18px;
    color: #23282d;
}

.plugin0-settings-info {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    margin-top: 30px;
}

.plugin0-settings-info h2 {
    margin-top: 0;
    color: #0073aa;
}

.plugin0-settings-info ol {
    margin-left: 20px;
}

.plugin0-settings-info li {
    margin-bottom: 15px;
}

.plugin0-settings-info strong {
    color: #23282d;
}

.plugin0-test-connection {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    margin-top: 20px;
}

.plugin0-test-connection h3 {
    margin-top: 0;
    color: #0073aa;
}

/* Responsive Design */
@media (max-width: 768px) {
    .plugin0-dashboard {
        grid-template-columns: 1fr;
    }

    .plugin0-stats {
        flex-direction: column;
        gap: 15px;
    }

    .plugin0-codes-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .plugin0-modal-content {
        width: 95%;
        margin: 20px;
    }

    .plugin0-code-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* Notice Styles */
.notice.inline {
    margin: 5px 0 15px 0;
    padding: 8px 12px;
}

/* Animation */
.plugin0-card,
.plugin0-modal-content {
    transition: all 0.3s ease;
}

.plugin0-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, .1);
}

/* Admin Bar Menu - Plugin0 Logo */
.plugin0-admin-bar-item a.ab-item {
    position: relative;
}

#wpadminbar .plugin0-admin-bar-item > a.ab-item::before {
    background-image: url('/wp-content/plugins/p0-connect/assets/images/p0-white-1.svg') !important;
}

.menupop.plugin0-admin-bar-item ul li{
    float: left !important;
}

#wpadminbar .plugin0-admin-bar-item a.ab-item::before {
    content: "" !important;
    background-size: 16px 16px !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
    width: 16px !important;
    height: 16px !important;
    display: inline-block !important;
    vertical-align: middle !important;
    margin-right: 2px !important;
    font: normal 16px / 1 !important;
    padding: 4px 0 !important;
    margin-top: 4px !important;
    margin-right: 4px !important;
}

/* Ensure proper positioning in top-secondary - before profile menu */
#wp-admin-bar-top-secondary #wp-admin-bar-plugin0 {
    float: left;
    margin-right: 10px;
}

/* Admin Menu Icon */
#adminmenu .toplevel_page_plugin0 .wp-menu-image::before {
    content: "";
    background-image: url('../images/p0.svg');
    background-size: 20px 20px;
    background-repeat: no-repeat;
    background-position: center;
    width: 20px;
    height: 20px;
    display: inline-block;
}

#adminmenu .toplevel_page_plugin0 .wp-menu-image {
    background: none !important;
}

/* Hover effect to show sidebar menu when hovering over topbar menu */
body.toplevel_page_plugin0 .notice{
    display: none;
}

/* Hide notices on codes page */
.plugin0-codes-page .notice {
    display: none;
}

/* Codes page title margin */
.plugin0-codes-page h1 {
    margin-bottom: 10px;
}

.plugin0-modal {
    position: fixed;
    z-index: 100000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: none;
}

.plugin0-modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 0;
    border: 1px solid #888;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    border-radius: 4px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.plugin0-modal-header {
    padding: 15px 20px;
    background-color: #f1f1f1;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.plugin0-modal-header h2 {
    margin: 0;
    font-size: 18px;
}

.plugin0-modal-close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.plugin0-modal-close:hover {
    color: #000;
}

.plugin0-modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}



.plugin0-code-content {
    border: 1px solid #ddd;
    border-radius: 4px;
}

.plugin0-code-header {
    padding: 10px 15px;
    background-color: #f5f5f5;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.plugin0-file-name {
    font-family: monospace;
    font-weight: 500;
    color: #333;
}

.plugin0-modal-body pre {
    margin: 0;
    padding: 15px;
    background-color: #f8f8f8;
    border-radius: 0 0 4px 4px;
    overflow-x: auto;
    max-height: 400px;
    overflow-y: auto;
}

.plugin0-modal-body code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.4;
    color: #333;
}

.plugin0-modal-footer {
    padding: 15px 20px;
    background-color: #f9f9f9;
    border-top: 1px solid #ddd;
    text-align: right;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.plugin0-modal-footer .button {
    margin: 0;
}

/* Toggle Switch Styles */
.plugin0-toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

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

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

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

input:checked + .plugin0-toggle-slider {
    background-color: #0073aa;
}

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

.plugin0-toggle-switch input:focus + .plugin0-toggle-slider {
    box-shadow: 0 0 1px #0073aa;
}

/* Custom table styles */
.plugin0-codes-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.plugin0-codes-table th,
.plugin0-codes-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.plugin0-codes-table th {
    background-color: #f1f1f1;
    font-weight: 600;
}

.plugin0-codes-table tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

.plugin0-codes-table tbody tr:hover {
    background-color: #f0f0f0;
}

/* Column widths */
.status-col {
    width: 50px;
    text-align: center;
}

.title-col {
    width: 30%;
}

.type-col {
    width: 80px;
}

.file-col {
    width: 100px;
}

.date-col {
    width: 150px;
}

.actions-col {
    width: 120px;
    text-align: center;
}