/**
 * Admin Styles
 * Uses WordPress native styles
 *
 * @package Eraclito_PDB_Pro
 * @since 1.7.0
 */

/* Main container */
.pdb-main-wrap {
    max-width: 1200px;
    margin: 20px 0;
}

/* Page header: banner */
.pdb-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    padding: 20px 30px;
    background: #FFEE00;
    background: linear-gradient(90deg, rgba(255, 238, 0, 1) 2%, rgba(255, 238, 0, 1) 58%, rgba(255, 204, 0, 1) 91%);
    border-bottom: 6px solid #003466;
    color: #003466;
    box-shadow: 0 1px 1px rgba(0,0,0,0.04);
}

.pdb-page-header-text {
    flex: 0 1 50%;
    min-width: 0;
}

.wrap .pdb-page-header h1 {
    margin: 0 0 8px;
    padding: 0;
    font-size: 30px;
    font-weight: 600;
    line-height: 1.2;
    color: #003466;
}

.pdb-page-header p {
    margin: 0;
    font-size: 14px;
    color: #003466;
}

.pdb-page-header-logo {
    flex: 0 0 auto;
    align-self: stretch;
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.pdb-page-header-logo img {
    display: block;
    height: 105px;
    width: auto;
    max-width: 100%;
}

.pdb-page-header .pdb-beta-badge {
    background: #003466;
    color: #FFEE00;
}

@media (max-width: 782px) {
    .pdb-page-header {
        padding: 16px 20px;
    }

    .pdb-page-header-text {
        flex-basis: 100%;
    }

    .pdb-page-header-logo {
        display: none;
    }
}

/* Form styles */
.pdb-form-table {
    background: #fff;
    border: 1px solid #c3c4c7;
    box-shadow: 0 1px 1px rgba(0,0,0,0.04);
}

.pdb-form-row {
    padding: 15px;
    border-bottom: 1px solid #c3c4c7;
}

.pdb-form-row:last-child {
    border-bottom: none;
}

.pdb-form-row label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.pdb-form-row input[type="text"],
.pdb-form-row input[type="email"],
.pdb-form-row input[type="number"],
.pdb-form-row select,
.pdb-form-row textarea {
    width: 100%;
    max-width: 500px;
}

.pdb-form-row small {
    display: block;
    margin-top: 5px;
    color: #646970;
    font-style: italic;
}

/* Grid layout */
.pdb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.pdb-col {
    background: #fff;
    padding: 20px;
    border: 1px solid #c3c4c7;
    box-shadow: 0 1px 1px rgba(0,0,0,0.04);
}

/* Modal styles */
.pdb-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999999;
}

.pdb-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.pdb-modal-dialog {
    position: relative;
    max-width: 600px;
    margin: 50px auto;
    max-height: 90vh;
    overflow-y: auto;
}

.pdb-modal-content {
    background: #fff;
    border-radius: 3px;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.pdb-modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #ddd;
    background: #2271b1;
    color: #fff;
    position: relative;
}

.pdb-modal-header h2 {
    margin: 0;
    font-size: 18px;
    color: #fff;
}

.pdb-close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px;
    color: #fff;
    cursor: pointer;
    line-height: 1;
}

.pdb-close-modal:hover {
    color: #f0f0f0;
}

.pdb-modal-body {
    padding: 20px;
}

.pdb-modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #dcdcde;
    background: #f6f7f7;
    text-align: right;
}

.pdb-error-message {
    color: #d63638;
    background: #fcf0f1;
    border: 1px solid #d63638;
    padding: 10px;
    margin: 10px 0;
    border-radius: 3px;
}

/* Loader */
.pdb-loader {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000000;
    align-items: center;
    justify-content: center;
}

.pdb-loader.active {
    display: flex;
}

.pdb-loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.pdb-loader-content {
    position: relative;
    text-align: center;
    background: #fff;
    padding: 30px 40px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.pdb-loader-content img {
    display: block;
    margin: 0 auto 15px;
    max-width: 100px;
}

.pdb-loader-content p {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #2271b1;
}

/* Error messages */
.pdb-error {
    color: #d63638;
    padding: 10px;
    margin: 10px 0;
}

/* Success messages */
.pdb-success {
    color: #00a32a;
    padding: 10px;
    margin: 10px 0;
}

/* Buttons using WordPress styles */
.button.pdb-button-primary {
    background: #2271b1;
    border-color: #2271b1;
    color: #fff;
}

.button.pdb-button-primary:hover {
    background: #135e96;
    border-color: #135e96;
}

.button.pdb-button-secondary {
    background: #f6f7f7;
    border-color: #c3c4c7;
    color: #2c3338;
}

.button.pdb-button-danger {
    background: #d63638;
    border-color: #d63638;
    color: #fff;
}

.button.pdb-button-danger:hover {
    background: #b32d2e;
    border-color: #b32d2e;
}

/* Quick LDV button in orders list */
.pdb-quick-request-ldv {
    background: #2271b1 !important;
    border-color: #2271b1 !important;
    color: #fff !important;
    font-size: 13px !important;
    padding: 2px 6px !important;
    height: auto !important;
    font-weight: 500 !important;
}

.pdb-quick-request-ldv:hover {
    background: #135e96 !important;
    border-color: #135e96 !important;
    color: #fff !important;
}

/* Package table */
.pdb-package-table {
    width: 100%;
    background: #fff;
    border: 1px solid #c3c4c7;
    box-shadow: 0 1px 1px rgba(0,0,0,0.04);
}

/* Package table action buttons */
.pdb-edit-package:hover {
    background: #135e96 !important;
    border-color: #135e96 !important;
}

.pdb-delete-package:hover {
    background: #b32d2e !important;
    border-color: #b32d2e !important;
}

.pdb-package-table thead {
    background: #f6f7f7;
}

.pdb-package-table th {
    padding: 10px;
    text-align: left;
    font-weight: 600;
    border-bottom: 1px solid #c3c4c7;
}

.pdb-package-table td {
    padding: 10px;
    border-bottom: 1px solid #f0f0f1;
}

.pdb-package-table tbody tr:hover {
    background: #f6f7f7;
}

/* Metabox styles */
.pdb-metabox-content {
    padding: 10px;
}

.pdb-metabox-icons {
    display: flex;
    gap: 5px;
    align-items: center;
    margin-bottom: 10px;
}

.pdb-metabox-icon {
    display: inline-block;
}

.pdb-metabox-icon img {
    width: 30px;
    height: 30px;
    vertical-align: middle;
}

/* Multicollo */
#pdb-multicollo-wrapper {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #dcdcde;
}

.pdb-multicollo-item {
    padding: 15px;
    margin-bottom: 15px;
    background: #f6f7f7;
    border: 1px solid #c3c4c7;
    border-radius: 3px;
}

.pdb-multicollo-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 600;
    color: #2271b1;
}

.pdb-multicollo-delete {
    color: #d63638;
    cursor: pointer;
    font-size: 12px;
    text-decoration: underline;
}

.pdb-multicollo-delete:hover {
    color: #b32d2e;
}

/* Debug styles */
.pdb-debug-box {
    background: #1e1e1e;
    color: #1ed44e;
    padding: 15px;
    border-radius: 3px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    margin: 15px 0;
}

.pdb-debug-box pre {
    margin: 0;
    white-space: pre-wrap;
}

/* License status */
.pdb-license-status {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 3px;
    font-weight: 600;
}

.pdb-license-status.active {
    background: #d5f6e3;
    color: #00a32a;
}

.pdb-license-status.expired {
    background: #f6d5d5;
    color: #d63638;
}

.pdb-license-status.inactive {
    background: #f0f0f1;
    color: #646970;
}

/* Responsive */
@media (max-width: 782px) {
    .pdb-grid {
        grid-template-columns: 1fr;
    }

    .pdb-form-row input[type="text"],
    .pdb-form-row input[type="email"],
    .pdb-form-row input[type="number"],
    .pdb-form-row select {
        max-width: 100%;
    }
}

/* Order list column icons */
.column-LdV .order-status {
    vertical-align: super;
    margin-right: 5px;
}

.column-LdV img {
    vertical-align: middle;
}

/* Help tooltips */
.pdb-help-tip {
    color: #646970;
    cursor: help;
    margin-left: 5px;
}

.pdb-help-tip:before {
    content: "\f223";
    font-family: dashicons;
    speak: never;
}

/* Info boxes */
.pdb-info-box {
    background: #f0f6fc;
    border-left: 4px solid #2271b1;
    padding: 15px;
    margin: 15px 0;
}

.pdb-warning-box {
    background: #fcf9e8;
    border-left: 4px solid #dba617;
    padding: 15px;
    margin: 15px 0;
}

.pdb-error-box {
    background: #fcf0f1;
    border-left: 4px solid #d63638;
    padding: 15px;
    margin: 15px 0;
}

/* Settings sections */
.pdb-settings-section {
    background: #fff;
    border: 1px solid #c3c4c7;
    margin-bottom: 20px;
    box-shadow: 0 1px 1px rgba(0,0,0,0.04);
    padding:20px;
}

.pdb-settings-section-header {
    padding: 15px 20px;
    border-bottom: 1px solid #c3c4c7;
    background: #f6f7f7;
}

.pdb-settings-section-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.pdb-settings-section-body {
    padding: 20px;
}

/* Guide sections */
.pdb-guide-section {
    margin: 30px 0;
}

.pdb-guide-section h3 {
    color: #2271b1;
    margin-bottom: 10px;
}

.pdb-guide-section h4 {
    text-decoration: underline;
    margin: 20px 0 10px;
}

.pdb-guide-section img {
    max-width: 100%;
    height: auto;
    border: 1px solid #c3c4c7;
    margin: 15px 0;
}

/* Deposits page — status badges */
.pdb-deposit-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: normal;
    text-align: center;
    line-height: 1.3;
    max-width: 100%;
    box-sizing: border-box;
}

.pdb-deposit-badge--ingiacenza {
    background: #fef3cd;
    color: #856404;
    border: 1px solid #ffc107;
}

.pdb-deposit-badge--svincolata {
    background: #d1e7dd;
    color: #0a3622;
    border: 1px solid #198754;
}

.pdb-deposit-badge--scaduta {
    background: #f8d7da;
    color: #58151c;
    border: 1px solid #dc3545;
}

.pdb-deposit-badge--richiesto {
    background: #cfe2ff;
    color: #084298;
    border: 1px solid #0d6efd;
}

.pdb-deposit-badge--svincolopr {
    background: #d1e7dd;
    color: #0a3622;
    border: 1px solid #198754;
}

/* Badge BETA */
.pdb-beta-badge {
    display: inline-block;
    vertical-align: middle;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 3px;
    background: #f0b849;
    color: #3c2a00;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    line-height: 1.6;
}

/* Pickups page — status badges */
.pdb-pickup-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    white-space: normal;
    text-align: center;
    line-height: 1.3;
    max-width: 100%;
    box-sizing: border-box;
    background: #f0f0f1;
    color: #3c434a;
    border: 1px solid #c3c4c7;
}

.pdb-pickup-badge--inserito {
    background: #cfe2ff;
    color: #084298;
    border-color: #0d6efd;
}

.pdb-pickup-badge--prenotato,
.pdb-pickup-badge--in_esecuzione {
    background: #fef3cd;
    color: #856404;
    border-color: #ffc107;
}

.pdb-pickup-badge--effettuato {
    background: #d1e7dd;
    color: #0a3622;
    border-color: #198754;
}

.pdb-pickup-badge--non_effettuato,
.pdb-pickup-badge--ritiro_annullato {
    background: #f8d7da;
    color: #58151c;
    border-color: #dc3545;
}

/* Keep a gap from the right edge on plugin pages (small screens) */
#wpbody-content:has(.pdb-main-wrap) {
    width: 98%;
}

/* Dashboard */
.pdb-dash-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.pdb-dash-card {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 18px 20px;
    background: #fff;
    border: none;
    border-bottom: 4px solid #003466;
    box-shadow: 0 1px 1px rgba(0,0,0,0.04);
    color: #1d2327;
    text-decoration: none;
}

.pdb-dash-card:hover,
.pdb-dash-card:focus {
    border-bottom-color: #FFCC00;
    color: #1d2327;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.pdb-dash-card--alert {
    border-bottom-color: #d63638;
}

.pdb-dash-card-label {
    font-size: 13px;
    font-weight: 600;
    color: #50575e;
}

.pdb-dash-card-number {
    font-size: 40px;
    font-weight: 600;
    line-height: 1.1;
    color: #003466;
}

.pdb-dash-card--alert .pdb-dash-card-number {
    color: #d63638;
}

.pdb-dash-card-note {
    font-size: 12px;
    color: #646970;
}

.pdb-dash-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.pdb-dash-panel {
    background: #fff;
    border: none;
    box-shadow: 0 1px 1px rgba(0,0,0,0.04);
    padding: 20px;
}

.pdb-dash-panel h2 {
    margin: 0 0 14px;
    font-size: 16px;
    font-weight: 600;
}

.pdb-dash-license h2 {
    margin-bottom: 15px;
    padding-bottom: 14px;
    border-bottom: 1px solid #dcdcde;
}

.pdb-dash-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.pdb-dash-button {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 14px;
    background: #f0f0f0;
    border: none;
    color: #003466;
    text-decoration: none;
}

.pdb-dash-button:hover,
.pdb-dash-button:focus {
    background: #FFEE00;
    color: #003466;
}

.pdb-dash-button .dashicons {
    width: 28px;
    height: 28px;
    font-size: 28px;
}

.pdb-dash-button small {
    font-size: 11px;
    line-height: 1.3;
    color: #50575e;
}

.pdb-dash-license dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 14px;
    margin: 0;
}

.pdb-dash-license dt {
    font-weight: 600;
    color: #50575e;
}

.pdb-dash-license dd {
    margin: 0;
    word-break: break-word;
}

.pdb-dash-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-right: 6px;
    border-radius: 50%;
    background: #a7aaad;
}

.pdb-dash-dot--ok { background: #00a32a; }
.pdb-dash-dot--bad { background: #d63638; }

.pdb-dash-tabs {
    margin-bottom: 16px;
}

.pdb-dash-empty {
    margin: 8px 0 16px;
    color: #646970;
}

@media (max-width: 1100px) {
    .pdb-dash-cards,
    .pdb-dash-buttons {
        grid-template-columns: repeat(2, 1fr);
    }

    .pdb-dash-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .pdb-dash-cards,
    .pdb-dash-buttons {
        grid-template-columns: 1fr;
    }
}
