/* ==================================================
   Panel Zamówień - Styl WordPress
   ================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif;
    color: #23282d;
    background: #f1f1f1;
    line-height: 1.6;
}

body.wp-admin {
    background: #f1f1f1;
}

/* ==================================================
   HEADER
   ================================================== */

.header {
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-brand h1 {
    font-size: 20px;
    font-weight: 600;
    color: #23282d;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-name {
    color: #666;
    font-size: 13px;
    font-weight: 500;
}

/* ==================================================
   CONTAINER
   ================================================== */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* ==================================================
   BUTTONS
   ================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: 3px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    white-space: nowrap;
    line-height: 1.5;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
}

.btn-primary:hover {
    background: #005a87;
    border-color: #005a87;
}

.btn-secondary {
    background: #f8f9fa;
    color: #23282d;
    border-color: #ddd;
}

.btn-secondary:hover {
    background: #f0f0f1;
    border-color: #ccc;
}

.btn-success {
    background: #46b450;
    color: white;
    border-color: #46b450;
}

.btn-success:hover {
    background: #3da340;
    border-color: #3da340;
}

.btn-danger {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

.btn-danger:hover {
    background: #c82333;
    border-color: #c82333;
}

.btn-warning {
    background: #ffb81c;
    color: #23282d;
    border-color: #ffb81c;
}

.btn-warning:hover {
    background: #e6a60a;
    border-color: #e6a60a;
}

.btn-info {
    background: #0073aa;
    color: white;
    border-color: #0073aa;
}

.btn-info:hover {
    background: #005a87;
    border-color: #005a87;
}

.btn-lg {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
}

.btn-sm {
    padding: 5px 10px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    padding: 6px;
    width: 36px;
    height: 36px;
    border-radius: 3px;
}

.btn i {
    font-size: 0.9em;
}

/* ==================================================
   FORM ELEMENTS
   ================================================== */

.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    color: #23282d;
    font-weight: 600;
    font-size: 13px;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 2px rgba(0, 115, 170, 0.1);
}

input[type="text"].error,
input[type="number"].error {
    border-color: #dc3545;
}

.input-hint {
    display: block;
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

.form-error {
    color: #dc3545;
    font-size: 12px;
    margin-top: 5px;
}

/* ==================================================
   SEARCH VIEW
   ================================================== */

.search-view {
    display: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.search-view.active {
    display: block;
    opacity: 1;
}

.search-card {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 40px;
    max-width: 600px;
    margin: 60px auto;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.search-header {
    text-align: center;
    margin-bottom: 40px;
}

.search-header h2 {
    font-size: 24px;
    color: #23282d;
    margin-bottom: 8px;
    font-weight: 600;
}

.search-header p {
    color: #666;
    font-size: 14px;
}

.search-form {
    margin-bottom: 30px;
}

.search-input {
    font-size: 16px !important;
    padding: 12px 14px !important;
    text-align: center;
    border: 1px solid #ddd !important;
}

.search-form .form-group {
    margin-bottom: 20px;
}

.search-form .btn {
    width: 100%;
}

.search-tips {
    background: #e7f3ff;
    border-left: 4px solid #0073aa;
    padding: 15px;
    border-radius: 3px;
    font-size: 13px;
    color: #004085;
}

.search-tips strong {
    display: block;
    margin-bottom: 8px;
}

.search-tips ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

.search-tips li {
    margin-bottom: 5px;
    padding-left: 0;
}

/* ==================================================
   ORDER DETAIL VIEW
   ================================================== */

.order-detail-view {
    display: none;
}

.order-detail-view.active {
    display: block;
}

.order-header {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.order-header-info h2 {
    font-size: 18px;
    margin-bottom: 4px;
    color: #23282d;
    font-weight: 600;
}

.order-header-status {
    font-size: 12px;
    color: #666;
    margin-bottom: 8px;
}

.order-header-actions {
    display: flex;
    gap: 8px;
}

.order-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

.order-status.pending {
    background: #fff8e5;
    color: #9c6d00;
}

.order-status.processing {
    background: #e3f2fd;
    color: #0073aa;
}

.order-status.completed {
    background: #e8f5e9;
    color: #27ae60;
}

/* ==================================================
   ORDER CONTENT
   ================================================== */

.order-content {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.order-sub-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

@media (max-width: 1024px) {
    .order-content {
        grid-template-columns: 1fr;
    }
}

.order-section, .order-sub-section {
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.order-section {
    margin-top: 10px;
}

.order-section-title {
    font-size: 14px;
    font-weight: 600;
    color: #23282d;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 8px;
}

.order-section-title i {
    color: #0073aa;
    font-size: 16px;
}

.order-section-title-icon {
    font-size: 16px;
}

/* ==================================================
   ORDER PRODUCTS
   ================================================== */

.order-products-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
}

.order-products-table thead {
    background: #f5f5f5;
    border-bottom: 1px solid #ddd;
}

.order-products-table th {
    padding: 8px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: #23282d;
    text-transform: uppercase;
}

.order-products-table td {
    padding: 8px;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}

.product-name {
    font-weight: 600;
    color: #23282d;
}

.product-details {
    font-size: 12px;
    color: #666;
    margin-top: 3px;
}

.product-status {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    background: #e3f2fd;
    color: #0073aa;
}

/* ==================================================
   ORDER DETAILS
   ================================================== */

.detail-row {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

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

.detail-label {
    font-weight: 600;
    color: #666;
    width: 140px;
    flex-shrink: 0;
    font-size: 12px;
}

.detail-value {
    color: #23282d;
    flex: 1;
    font-size: 13px;
}

.detail-value.emphasized {
    font-weight: 600;
    color: #0073aa;
}

/* ==================================================
   ORDER SUMMARY
   ================================================== */

.order-summary {
    background: #f9f9f9;
    border-radius: 3px;
    padding: 15px;
    margin-top: 20px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 13px;
    color: #23282d;
}

.summary-row.total {
    border-top: 1px solid #ddd;
    padding-top: 12px;
    font-size: 14px;
    font-weight: 600;
    color: #23282d;
}

.summary-row.total .summary-value {
    color: #46b450;
    font-size: 16px;
    font-weight: 600;
}

/* ==================================================
   INVOICES
   ================================================== */

.invoices-list {
    margin-top: 20px;
}

.invoice-item {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 15px;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.15s;
}

.invoice-item:hover {
    background: white;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
}

.invoice-info {
    flex: 1;
}

.invoice-number {
    font-weight: 600;
    color: #23282d;
    font-size: 13px;
    margin-bottom: 5px;
}

.invoice-details {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #666;
    flex-wrap: wrap;
}

.invoice-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    text-transform: capitalize;
    margin-right: 0;
}

.invoice-badge.receipt {
    background: #e3f2fd;
    color: #0073aa;
}

.invoice-badge.invoice {
    background: #e8f5e9;
    color: #27ae60;
}

.invoice-badge.issued {
    background: #e8f5e9;
    color: #27ae60;
}

.invoice-badge.draft {
    background: #fff8e5;
    color: #9c6d00;
}

.invoice-actions {
    display: flex;
    gap: 6px;
}

.invoice-empty {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.invoice-empty i {
    font-size: 48px;
    margin-bottom: 12px;
    color: #ddd;
}

/* ==================================================
   ALERTS & MESSAGES
   ================================================== */

.alert {
    padding: 12px 15px;
    border-radius: 3px;
    margin-bottom: 20px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.alert-icon {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 2px;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 3px;
    font-size: 13px;
}

.alert-message {
    font-size: 13px;
    line-height: 1.5;
}

.alert-success {
    background: #e8f5e9;
    color: #27ae60;
    border: 1px solid #c8e6c9;
}

.alert-info {
    background: #e3f2fd;
    color: #0073aa;
    border: 1px solid #bbdefb;
}

.alert-warning {
    background: #fff8e5;
    color: #9c6d00;
    border: 1px solid #ffe0b2;
}

.alert-error {
    background: #ffebee;
    color: #c41c3b;
    border: 1px solid #ffcdd2;
}

/* ==================================================
   MODALS
   ================================================== */

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 999;
}

.modal-backdrop.active {
    display: block;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 4px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    width: 90%;
    display: none;
    z-index: 1000;
}

.modal.active {
    display: block;
}

.modal-content {
    padding: 20px;
    text-align: center;
}

.modal-content h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: #23282d;
    font-weight: 600;
}

.modal-content p {
    color: #666;
    margin-bottom: 20px;
    line-height: 1.5;
    font-size: 13px;
}

.alert-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 16px;
    border: 3px solid #f0f0f0;
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.modal-actions .btn {
    flex: 1;
}

/* ==================================================
   BACK BUTTON
   ================================================== */

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 20px;
    color: #0073aa;
    background: none;
    border: none;
    padding: 6px 0;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
    transition: color 0.15s;
}

.back-button:hover {
    color: #005a87;
}

.back-button i {
    font-size: 12px;
}

/* ==================================================
   LOGIN PAGE STYLES
   ================================================== */

body.login-page {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #afafaf;
}

.login-container {
    background: white;
    padding: 40px;
    border-radius: 4px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 380px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 24px;
    color: #23282d;
    margin-bottom: 8px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-header h1 i {
    color: #0073aa;
    font-size: 28px;
}

.login-header p {
    color: #666;
    font-size: 13px;
}

.login-container button {
    width: 100%;
    padding: 10px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 3px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.login-container button:hover {
    background: #005a87;
}

.login-container button:active {
    background: #004080;
}

.credentials-info {
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 3px;
    padding: 15px;
    margin-top: 20px;
    font-size: 12px;
    color: #0073aa;
}

.credentials-info strong {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.credentials-info code {
    display: block;
    margin: 4px 0;
    background: white;
    padding: 4px 8px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    color: #23282d;
}

.form-group.error input {
    border-color: #dc3545 !important;
}

.error-message {
    color: #dc3545;
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

.form-group.error .error-message {
    display: block;
}

/* ==================================================
   RESPONSIVE
   ================================================== */

@media (max-width: 768px) {
    .container {
        padding: 12px;
    }

    .search-card {
        padding: 30px 20px;
        margin: 40px 0;
    }

    .search-header h2 {
        font-size: 20px;
    }

    .order-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .order-header-actions {
        margin-top: 16px;
        width: 100%;
    }

    .order-header-actions .btn {
        flex: 1;
    }

    .order-content {
        grid-template-columns: 1fr;
    }

    .invoice-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .invoice-actions {
        margin-top: 12px;
        width: 100%;
    }

    .invoice-actions .btn {
        flex: 1;
    }

    .detail-row {
        flex-direction: column;
    }

    .detail-label {
        width: auto;
        margin-bottom: 4px;
    }

    .header-inner {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .header-user {
        width: 100%;
        justify-content: flex-end;
    }

    .modal-content {
        padding: 20px;
    }

    .login-container {
        padding: 30px 20px;
        margin: 20px;
    }

    .login-header h1 {
        font-size: 20px;
    }
}

/* ==================================================
   UTILITIES
   ================================================== */

.text-muted {
    color: #999;
}

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

.mb-0 {
    margin-bottom: 0;
}

.mb-1 {
    margin-bottom: 8px;
}

.mb-2 {
    margin-bottom: 16px;
}

.mb-3 {
    margin-bottom: 24px;
}

.mt-2 {
    margin-top: 16px;
}

.mt-3 {
    margin-top: 24px;
}

.invisible {
    display: none;
}
