/* DS PowerOffice & Provisjon — Module styles */

/* ── Settings page ── */
.ds-po-settings .ds-subtitle,
.ds-provisjon-page .ds-subtitle {
    color: #666;
    margin-bottom: 24px;
    font-size: 14px;
}

.ds-po-settings .ds-card,
.ds-provisjon-page .ds-card {
    background: #fff;
    border-radius: 10px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.ds-po-settings .ds-card h2,
.ds-provisjon-page .ds-card h2 {
    font-size: 17px;
    font-weight: 600;
    margin: 0 0 4px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ds-card-desc {
    color: #888;
    font-size: 13px;
    margin: 0 0 20px 0;
}

/* ── Status box ── */
.ds-po-status-box {
    background: #fff;
    border-radius: 10px;
    padding: 16px 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
}

.ds-po-status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
}

.ds-po-status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ccc;
    display: inline-block;
    flex-shrink: 0;
}

.ds-po-status-dot.connected { background: #28a745; }
.ds-po-status-dot.disconnected { background: #dc3545; }
.ds-po-status-dot.checking { background: #ffc107; animation: ds-pulse 1s infinite; }

@keyframes ds-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ── Form ── */
.ds-po-form .ds-form-group {
    margin-bottom: 16px;
}

.ds-po-form label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

.ds-input-wrapper {
    position: relative;
}

.ds-input-wrapper input {
    width: 100%;
    max-width: 500px;
    padding: 10px 40px 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.15s;
}

.ds-input-wrapper input:focus {
    outline: none;
    border-color: #4a6cf7;
    box-shadow: 0 0 0 3px rgba(74,108,247,0.1);
}

.ds-input-status {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
}

.ds-input-status.has-key::after {
    content: "\2713";
    color: #28a745;
}

.ds-form-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-top: 20px;
}

/* ── Buttons ── */
.ds-po-settings .ds-btn,
.ds-provisjon-page .ds-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
    font-family: inherit;
}

.ds-btn-primary {
    background: #4a6cf7;
    color: #fff;
}
.ds-btn-primary:hover { background: #3a5ce5; }
.ds-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.ds-btn-secondary {
    background: #e9ecef;
    color: #333;
}
.ds-btn-secondary:hover { background: #dee2e6; }

.ds-btn-success {
    background: #28a745;
    color: #fff;
}
.ds-btn-success:hover { background: #218838; }

.ds-btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

/* ── Messages ── */
.ds-po-message {
    margin-top: 16px;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 13px;
}

.ds-po-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.ds-po-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.ds-po-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ── Sync info ── */
.ds-po-sync-info {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 16px;
}

.ds-po-sync-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 4px 0;
    font-size: 14px;
}

.ds-po-sync-label {
    font-weight: 600;
    color: #555;
    min-width: 120px;
}

.ds-po-sync-value {
    color: #333;
}

/* ── Provisjon page ── */
.ds-provisjon-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.ds-summary-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.ds-summary-label {
    font-size: 13px;
    color: #888;
    margin-bottom: 4px;
}

.ds-summary-value {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a2e;
}

/* ── Provisjon tables ── */
.ds-provisjon-section {
    margin-bottom: 20px;
}

.ds-provisjon-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin-top: 12px;
}

.ds-provisjon-table th {
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    color: #555;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e9ecef;
    background: #f8f9fa;
}

.ds-provisjon-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.ds-provisjon-table tr:last-child td {
    border-bottom: none;
}

.ds-provisjon-table tr:hover td {
    background: #f8f9fa;
}

/* ── Status badges ── */
.ds-prov-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.ds-prov-badge.paid {
    background: #d4edda;
    color: #155724;
}

.ds-prov-badge.unpaid {
    background: #fff3cd;
    color: #856404;
}

.ds-prov-badge.budget-yes {
    background: #d4edda;
    color: #155724;
}

.ds-prov-badge.budget-no {
    background: #f8d7da;
    color: #721c24;
}

.ds-prov-badge.ready {
    background: #d4edda;
    color: #155724;
}

.ds-prov-badge.paidout {
    background: #e2e3e5;
    color: #383d41;
}

/* ── Seller group header ── */
.ds-provisjon-seller-group {
    margin-bottom: 24px;
}

.ds-provisjon-seller-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0 8px;
    border-bottom: 2px solid #4a6cf7;
    margin-bottom: 8px;
}

.ds-provisjon-seller-name {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a2e;
}

.ds-provisjon-seller-total {
    font-size: 15px;
    font-weight: 600;
    color: #4a6cf7;
}

/* ── Empty state ── */
.ds-empty-state {
    color: #999;
    font-size: 14px;
    text-align: center;
    padding: 24px;
}

/* ── Loading spinner ── */
.ds-po-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-top-color: #4a6cf7;
    border-radius: 50%;
    animation: ds-spin 0.6s linear infinite;
}

@keyframes ds-spin {
    to { transform: rotate(360deg); }
}

/* ── Invoice payment status ── */
.ds-invoice-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: 12px;
}

.ds-invoice-paid {
    background: #d4edda;
    color: #155724;
}

.ds-invoice-unpaid {
    background: #f8d7da;
    color: #721c24;
}

.ds-invoice-unsynced {
    background: #e9ecef;
    color: #6c757d;
}

.ds-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

.ds-status-dot.paid { background: #28a745; }
.ds-status-dot.unpaid { background: #dc3545; }
.ds-status-dot.unsynced { background: #adb5bd; }

/* ── Grand total bar ── */
.ds-provisjon-grand-total {
    padding: 16px 0 0;
    border-top: 2px solid #dee2e6;
    margin-top: 16px;
    text-align: right;
    font-size: 16px;
}

/* ── History month block ── */
.ds-provisjon-history-month {
    margin-bottom: 24px;
}

/* ── Manual entry form ── */
.ds-provisjon-page select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
}

.ds-provisjon-page select:focus {
    outline: none;
    border-color: #4a6cf7;
    box-shadow: 0 0 0 3px rgba(74,108,247,0.1);
}

.ds-provisjon-page input[type="month"],
.ds-provisjon-page input[type="number"],
.ds-provisjon-page input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.ds-provisjon-page input[type="month"]:focus,
.ds-provisjon-page input[type="number"]:focus,
.ds-provisjon-page input[type="text"]:focus {
    outline: none;
    border-color: #4a6cf7;
    box-shadow: 0 0 0 3px rgba(74,108,247,0.1);
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .ds-provisjon-summary {
        grid-template-columns: 1fr;
    }

    .ds-provisjon-table {
        font-size: 13px;
    }

    .ds-provisjon-table th,
    .ds-provisjon-table td {
        padding: 8px;
    }

    .ds-po-sync-row {
        flex-direction: column;
        gap: 2px;
    }

    .ds-provisjon-seller-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .ds-form-actions {
        flex-direction: column;
    }

    .ds-input-wrapper input {
        max-width: 100%;
    }
}
