/**
 * WPEstate Advanced Invoices - Professional Stylesheet
 * International standard invoice designs with modern aesthetics
 * Supports RTL languages and responsive layouts
 *
 * @package WPEstate_Advanced_Invoices
 * @version 1.0.0
 */

/* ==========================================================================
   RESET & BASE STYLES
   ========================================================================== */

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

.wpai-invoice {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #1a1a1a;
    background: white;
    max-width: 900px;
    margin: 0 auto;
    padding: 40px;
    position: relative;
}

@media print {
    .wpai-invoice {
        max-width: none;
        padding: 20px;
        box-shadow: none;
    }
}

/* RTL Support */
.wpai-invoice[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

.wpai-invoice[dir="rtl"] .wpai-align-right {
    text-align: left !important;
}

.wpai-invoice[dir="rtl"] .wpai-header-left {
    text-align: right;
}

.wpai-invoice[dir="rtl"] .wpai-header-right {
    text-align: left;
}

/* ==========================================================================
   TYPOGRAPHY
   ========================================================================== */

.wpai-invoice h1,
.wpai-invoice h2,
.wpai-invoice h3,
.wpai-invoice h4 {
    font-weight: 600;
    line-height: 1.2;
    color: #1a1a1a;
}

.wpai-invoice h1 { font-size: 32px; }
.wpai-invoice h2 { font-size: 24px; }
.wpai-invoice h3 { font-size: 18px; }
.wpai-invoice h4 { font-size: 16px; }

.wpai-font-bold {
    font-weight: 600;
}

.wpai-text-primary {
    color: #3b82f6;
}

.wpai-text-success {
    color: #10b981;
}

.wpai-text-danger {
    color: #ef4444;
}

.wpai-align-right {
    text-align: right;
}

/* ==========================================================================
   MANAGER INVOICE STYLES - Professional & Detailed
   ========================================================================== */

.wpai-invoice-manager {
    background: linear-gradient(to bottom, #f8f9fa 0%, white 200px);
}

/* Header */
.wpai-invoice-manager .wpai-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 3px solid #e5e7eb;
}

.wpai-logo {
    max-width: 180px;
    max-height: 80px;
    margin-bottom: 20px;
}

.wpai-company-name {
    font-size: 28px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 10px;
}

.wpai-company-address {
    color: #64748b;
    line-height: 1.8;
}

.wpai-tax-id {
    color: #64748b;
    font-size: 13px;
    margin-top: 5px;
}

.wpai-invoice-badge {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    padding: 20px 25px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: center;
}

.wpai-badge-label {
    display: block;
    font-size: 12px;
    opacity: 0.9;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.wpai-invoice-number {
    display: block;
    font-size: 24px;
    font-weight: 700;
}

.wpai-invoice-meta {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.wpai-meta-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
}

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

.wpai-meta-label {
    font-weight: 600;
    color: #64748b;
}

.wpai-meta-value {
    color: #1e293b;
}

.wpai-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wpai-status-success {
    background: #d1fae5;
    color: #065f46;
}

.wpai-status-warning {
    background: #fef3c7;
    color: #92400e;
}

.wpai-status-danger {
    background: #fee2e2;
    color: #991b1b;
}

/* Info Section */
.wpai-info-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.wpai-info-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 25px;
}

.wpai-info-title {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f1f5f9;
}

.wpai-property-name,
.wpai-guest-name {
    font-size: 16px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 5px;
}

.wpai-property-address,
.wpai-guest-email {
    color: #64748b;
    margin-bottom: 15px;
}

.wpai-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.wpai-info-item {
    display: flex;
    flex-direction: column;
}

.wpai-info-label {
    font-size: 12px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.wpai-info-value {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

/* Financial Section */
.wpai-financial-section {
    margin-bottom: 40px;
}

.wpai-section-title {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e5e7eb;
}

.wpai-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.wpai-table thead th {
    background: #f8fafc;
    padding: 15px 20px;
    text-align: left;
    font-weight: 600;
    color: #475569;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #e2e8f0;
}

.wpai-table tbody td {
    padding: 12px 20px;
    border-bottom: 1px solid #f1f5f9;
}

.wpai-table tbody tr:last-child td {
    border-bottom: none;
}

.wpai-table tbody tr:hover {
    background: #f8fafc;
}

.wpai-table-header-main {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white !important;
    padding: 15px 20px;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
}

.wpai-subtotal-row {
    background: #f8fafc;
    font-weight: 600;
}

.wpai-total-row {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white !important;
}

.wpai-total-row td {
    padding: 15px 20px;
    font-size: 16px;
    border-bottom: none;
}

.wpai-highlight-row {
    background: #fef3c7;
}

.wpai-commission-row td {
    color: #dc2626;
    font-weight: 600;
}

.wpai-table-revenue tbody tr:nth-child(4n+1) {
    background: #fafbfc;
}

.wpai-table-commission {
    border: 2px solid #e5e7eb;
}

/* Sync Info */
.wpai-sync-info {
    background: #f0f9ff;
    border: 2px solid #bfdbfe;
    border-radius: 8px;
    padding: 20px;
    margin-top: 20px;
}

.wpai-sync-title {
    font-size: 14px;
    font-weight: 600;
    color: #1e40af;
    margin-bottom: 15px;
}

.wpai-sync-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
}

.wpai-sync-item {
    display: flex;
    flex-direction: column;
}

.wpai-sync-label {
    font-size: 12px;
    color: #3b82f6;
    margin-bottom: 4px;
}

.wpai-sync-value {
    font-size: 14px;
    font-weight: 600;
    color: #1e293b;
}

/* ==========================================================================
   OWNER INVOICE STYLES - Elegant & Clean
   ========================================================================== */

.wpai-invoice-owner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 0;
}

.wpai-invoice-owner > * {
    background: white;
}

.wpai-header-elegant {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 60px 40px;
    text-align: center;
    margin-bottom: 0;
}

.wpai-logo-large {
    max-width: 200px;
    max-height: 100px;
    margin-bottom: 20px;
    filter: brightness(0) invert(1);
}

.wpai-invoice-title {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 10px;
    color: white;
}

.wpai-invoice-subtitle {
    font-size: 16px;
    opacity: 0.9;
}

.wpai-owner-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    padding: 40px;
}

.wpai-owner-card,
.wpai-property-card {
    background: white;
    border: 2px solid #f3f4f6;
    border-radius: 16px;
    padding: 30px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.wpai-card-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
}

.wpai-card-content h3 {
    font-size: 14px;
    color: #64748b;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.wpai-owner-name,
.wpai-owner-email {
    color: #1e293b;
    margin-bottom: 5px;
}

.wpai-owner-name {
    font-size: 18px;
    font-weight: 600;
}

.wpai-property-meta {
    color: #64748b;
    font-size: 13px;
}

.wpai-booking-summary {
    padding: 40px;
    background: #fafbfc;
}

.wpai-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.wpai-summary-item {
    background: white;
    padding: 20px;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    display: flex;
    flex-direction: column;
}

.wpai-summary-label {
    font-size: 12px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.wpai-summary-value {
    font-size: 16px;
    font-weight: 700;
    color: #1e293b;
}

.wpai-financial-owner {
    padding: 40px;
}

.wpai-table-elegant {
    border: 2px solid #e5e7eb;
    border-radius: 12px;
}

.wpai-table-elegant thead th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    font-size: 16px;
}

.wpai-payout-info {
    margin-top: 30px;
}

.wpai-payout-notice {
    background: #eff6ff;
    border: 2px solid #3b82f6;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    gap: 15px;
    align-items: flex-start;
}

.wpai-payout-notice svg {
    flex-shrink: 0;
    color: #3b82f6;
}

.wpai-payout-notice p {
    color: #1e293b;
    line-height: 1.6;
}

.wpai-footer-elegant {
    background: #fafbfc;
    padding: 40px;
    text-align: center;
}

.wpai-footer-line {
    height: 3px;
    background: linear-gradient(90deg, transparent 0%, #667eea 50%, transparent 100%);
    margin-bottom: 20px;
}

/* ==========================================================================
   GUEST INVOICE STYLES - Modern & Welcoming
   ========================================================================== */

.wpai-invoice-guest {
    background: white;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.wpai-header-guest {
    background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
    color: white;
    padding: 50px 40px;
    position: relative;
    overflow: hidden;
}

.wpai-header-pattern {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: radial-gradient(circle at 25px 25px, rgba(255, 255, 255, 0.1) 2%, transparent 0%),
    radial-gradient(circle at 75px 75px, rgba(255, 255, 255, 0.1) 2%, transparent 0%);
    background-size: 100px 100px;
}

.wpai-header-content-guest {
    position: relative;
    z-index: 1;
    text-align: center;
}

.wpai-guest-title {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 10px;
}

.wpai-guest-subtitle {
    font-size: 18px;
    opacity: 0.9;
    margin-bottom: 20px;
}

.wpai-confirmation-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: 12px 25px;
    border-radius: 50px;
    font-weight: 600;
}

.wpai-guest-welcome {
    background: #fef3c7;
    padding: 30px 40px;
    text-align: center;
}

.wpai-guest-welcome h2 {
    font-size: 28px;
    color: #1e293b;
    margin-bottom: 10px;
}

.wpai-guest-welcome p {
    color: #64748b;
    font-size: 16px;
}

.wpai-property-showcase {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 30px;
    padding: 40px;
    background: white;
}

.wpai-property-image {
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.wpai-property-image img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.wpai-property-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.wpai-property-details h3 {
    font-size: 24px;
    color: #1e293b;
    margin-bottom: 10px;
}

.wpai-property-location {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #64748b;
    font-size: 15px;
}

.wpai-booking-details-guest {
    padding: 40px;
    background: #fafbfc;
}

.wpai-booking-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}

.wpai-booking-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    padding: 25px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.wpai-booking-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.wpai-card-icon-large {
    width: 60px;
    height: 60px;
    margin: 0 auto 15px;
    background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.wpai-card-info {
    display: flex;
    flex-direction: column;
}

.wpai-card-label {
    font-size: 12px;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.wpai-card-value {
    font-size: 20px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
}

.wpai-card-time {
    font-size: 13px;
    color: #64748b;
}

.wpai-payment-summary {
    padding: 40px;
}

.wpai-table-guest {
    border: 2px solid #e5e7eb;
    border-radius: 16px;
}

.wpai-table-guest tbody td {
    padding: 15px 25px;
    font-size: 15px;
}

.wpai-total-row-guest {
    background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 100%);
    color: white !important;
}

.wpai-total-row-guest td {
    padding: 20px 25px;
    font-size: 18px;
}

.wpai-total-amount {
    font-size: 24px !important;
}

.wpai-balance-row td {
    color: #10b981;
    font-weight: 600;
}

.wpai-balance-due td {
    color: #ef4444 !important;
    font-weight: 700;
}

.wpai-important-info {
    padding: 30px 40px;
    background: #fffbeb;
    border-top: 3px solid #fbbf24;
}

.wpai-important-info h3 {
    font-size: 18px;
    color: #1e293b;
    margin-bottom: 15px;
}

.wpai-info-list {
    list-style: none;
    padding: 0;
}

.wpai-info-list li {
    position: relative;
    padding-left: 25px;
    margin-bottom: 10px;
    color: #64748b;
}

.wpai-info-list li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #10b981;
    font-weight: bold;
}

.wpai-footer-guest {
    background: #f8fafc;
    padding: 40px;
}

.wpai-footer-contact {
    text-align: center;
    margin-bottom: 20px;
}

.wpai-footer-contact h4 {
    font-size: 18px;
    color: #1e293b;
    margin-bottom: 8px;
}

.wpai-footer-contact a {
    color: #0ea5e9;
    text-decoration: none;
}

.wpai-footer-contact a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   COMMON FOOTER STYLES
   ========================================================================== */

.wpai-footer {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #e5e7eb;
}

.wpai-footer-note p {
    color: #64748b;
    font-size: 13px;
    margin-bottom: 8px;
}

.wpai-footer-small {
    font-size: 12px;
    color: #94a3b8;
}

.wpai-footer-branding {
    margin-top: 15px;
    text-align: center;
}

.wpai-footer-social {
    text-align: center;
    padding-top: 20px;
}

/* ==========================================================================
   ERROR & UTILITY STYLES
   ========================================================================== */

.wpai-error {
    background: #fee2e2;
    border: 2px solid #ef4444;
    color: #991b1b;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
}

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

@media screen and (max-width: 768px) {
    .wpai-invoice {
        padding: 20px;
    }

    .wpai-invoice-manager .wpai-header,
    .wpai-info-section,
    .wpai-owner-section,
    .wpai-property-showcase {
        grid-template-columns: 1fr;
    }

    .wpai-summary-grid,
    .wpai-booking-cards {
        grid-template-columns: 1fr;
    }

    .wpai-sync-grid {
        grid-template-columns: 1fr;
    }

    .wpai-info-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
    .wpai-invoice {
        box-shadow: none;
        padding: 0;
    }

    .wpai-invoice-owner {
        background: white;
    }

    .wpai-header-pattern {
        display: none;
    }

    .wpai-booking-card:hover {
        transform: none;
        box-shadow: none;
    }

    .wpai-table tbody tr:hover {
        background: transparent;
    }
}