/**
 * PayByMay Platform - Frontend Styles
 * Stripe-inspired, modern payment processor UX
 */

/* CSS Variables */
:root {
    --pbm-primary: #635bff;
    --pbm-primary-hover: #5349e8;
    --pbm-success: #22c55e;
    --pbm-warning: #f59e0b;
    --pbm-danger: #ef4444;
    --pbm-info: #3b82f6;
    --pbm-purple: #8b5cf6;
    --pbm-cyan: #06b6d4;
    --pbm-gray-50: #f9fafb;
    --pbm-gray-100: #f3f4f6;
    --pbm-gray-200: #e5e7eb;
    --pbm-gray-300: #d1d5db;
    --pbm-gray-400: #9ca3af;
    --pbm-gray-500: #6b7280;
    --pbm-gray-600: #4b5563;
    --pbm-gray-700: #374151;
    --pbm-gray-800: #1f2937;
    --pbm-gray-900: #111827;
    --pbm-radius: 8px;
    --pbm-radius-lg: 12px;
    --pbm-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --pbm-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --pbm-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --pbm-transition: all 0.2s ease;
}

/* Base Container */
.pbm-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 24px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--pbm-gray-800);
    line-height: 1.6;
}

.pbm-container * {
    box-sizing: border-box;
}

/* Login Required Message */
.pbm-login-required {
    text-align: center;
    padding: 60px 20px;
    background: var(--pbm-gray-50);
    border-radius: var(--pbm-radius-lg);
}

.pbm-login-required p {
    margin-bottom: 20px;
    color: var(--pbm-gray-600);
}

.pbm-login-required .pbm-btn {
    display: inline-block;
}

/* Page Headers */
.pbm-page-header {
    margin-bottom: 32px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--pbm-gray-200);
}

.pbm-page-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--pbm-gray-900);
    margin: 0 0 8px 0;
}

.pbm-page-header p {
    font-size: 15px;
    color: var(--pbm-gray-500);
    margin: 0;
}

/* Stats Cards Grid */
.pbm-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.pbm-stat-card {
    background: white;
    border: 1px solid var(--pbm-gray-200);
    border-radius: var(--pbm-radius-lg);
    padding: 24px;
    transition: var(--pbm-transition);
}

.pbm-stat-card:hover {
    box-shadow: var(--pbm-shadow-md);
    border-color: var(--pbm-gray-300);
}

.pbm-stat-card .pbm-stat-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--pbm-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.pbm-stat-card .pbm-stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--pbm-gray-900);
}

.pbm-stat-card.pbm-stat-primary .pbm-stat-value {
    color: var(--pbm-primary);
}

.pbm-stat-card.pbm-stat-success .pbm-stat-value {
    color: var(--pbm-success);
}

.pbm-stat-card.pbm-stat-warning .pbm-stat-value {
    color: var(--pbm-warning);
}

/* Section Cards */
.pbm-section {
    background: white;
    border: 1px solid var(--pbm-gray-200);
    border-radius: var(--pbm-radius-lg);
    margin-bottom: 24px;
    overflow: hidden;
}

.pbm-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--pbm-gray-200);
    background: var(--pbm-gray-50);
}

.pbm-section-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: var(--pbm-gray-800);
    margin: 0;
}

.pbm-section-body {
    padding: 24px;
}

/* Status Badges */
.pbm-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 100px;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.pbm-status-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    margin-right: 6px;
    opacity: 0.5;
}

/* Buttons */
.pbm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--pbm-radius);
    border: none;
    cursor: pointer;
    transition: var(--pbm-transition);
    text-decoration: none;
    line-height: 1.4;
}

.pbm-btn-primary {
    background: var(--pbm-primary);
    color: white;
}

.pbm-btn-primary:hover {
    background: var(--pbm-primary-hover);
    color: white;
}

.pbm-btn-secondary {
    background: white;
    color: var(--pbm-gray-700);
    border: 1px solid var(--pbm-gray-300);
}

.pbm-btn-secondary:hover {
    background: var(--pbm-gray-50);
    border-color: var(--pbm-gray-400);
}

.pbm-btn-success {
    background: var(--pbm-success);
    color: white;
}

.pbm-btn-success:hover {
    background: #16a34a;
}

.pbm-btn-danger {
    background: var(--pbm-danger);
    color: white;
}

.pbm-btn-danger:hover {
    background: #dc2626;
}

.pbm-btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.pbm-btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

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

/* Forms */
.pbm-form {
    max-width: 600px;
}

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

.pbm-form-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--pbm-gray-700);
    margin-bottom: 6px;
}

.pbm-form-group label .pbm-required {
    color: var(--pbm-danger);
}

.pbm-form-control {
    width: 100%;
    padding: 12px 14px;
    font-size: 15px;
    border: 1px solid var(--pbm-gray-300);
    border-radius: var(--pbm-radius);
    background: white;
    color: var(--pbm-gray-800);
    transition: var(--pbm-transition);
}

.pbm-form-control:focus {
    outline: none;
    border-color: var(--pbm-primary);
    box-shadow: 0 0 0 3px rgba(99, 91, 255, 0.1);
}

.pbm-form-control::placeholder {
    color: var(--pbm-gray-400);
}

textarea.pbm-form-control {
    min-height: 120px;
    resize: vertical;
}

select.pbm-form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.pbm-form-hint {
    font-size: 13px;
    color: var(--pbm-gray-500);
    margin-top: 6px;
}

.pbm-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 600px) {
    .pbm-form-row {
        grid-template-columns: 1fr;
    }
}

/* Tables */
.pbm-table-wrapper {
    overflow-x: auto;
}

.pbm-table {
    width: 100%;
    border-collapse: collapse;
}

.pbm-table th,
.pbm-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--pbm-gray-200);
}

.pbm-table th {
    font-size: 12px;
    font-weight: 600;
    color: var(--pbm-gray-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--pbm-gray-50);
}

.pbm-table td {
    font-size: 14px;
    color: var(--pbm-gray-700);
}

.pbm-table tbody tr:hover {
    background: var(--pbm-gray-50);
}

.pbm-table-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--pbm-gray-500);
}

/* Reference Code */
.pbm-reference-code {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--pbm-gray-100);
    border: 1px solid var(--pbm-gray-200);
    border-radius: var(--pbm-radius);
    font-family: "SF Mono", Monaco, "Cascadia Code", monospace;
    font-size: 14px;
    font-weight: 600;
    color: var(--pbm-gray-800);
}

.pbm-reference-code .pbm-copy-btn {
    padding: 4px 8px;
    font-size: 11px;
    background: white;
    border: 1px solid var(--pbm-gray-300);
    border-radius: 4px;
    cursor: pointer;
    transition: var(--pbm-transition);
}

.pbm-reference-code .pbm-copy-btn:hover {
    background: var(--pbm-gray-50);
}

.pbm-reference-code .pbm-copy-btn.copied {
    background: var(--pbm-success);
    border-color: var(--pbm-success);
    color: white;
}

/* Timeline */
.pbm-timeline {
    position: relative;
    padding-left: 32px;
}

.pbm-timeline::before {
    content: "";
    position: absolute;
    left: 11px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--pbm-gray-200);
}

.pbm-timeline-item {
    position: relative;
    padding-bottom: 24px;
}

.pbm-timeline-item:last-child {
    padding-bottom: 0;
}

.pbm-timeline-marker {
    position: absolute;
    left: -32px;
    top: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--pbm-gray-300);
    display: flex;
    align-items: center;
    justify-content: center;
}

.pbm-timeline-item.pbm-timeline-active .pbm-timeline-marker {
    background: var(--pbm-primary);
    border-color: var(--pbm-primary);
}

.pbm-timeline-item.pbm-timeline-completed .pbm-timeline-marker {
    background: var(--pbm-success);
    border-color: var(--pbm-success);
}

.pbm-timeline-item.pbm-timeline-completed .pbm-timeline-marker::after {
    content: "✓";
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.pbm-timeline-content {
    background: white;
    border: 1px solid var(--pbm-gray-200);
    border-radius: var(--pbm-radius);
    padding: 16px;
}

.pbm-timeline-time {
    font-size: 12px;
    color: var(--pbm-gray-500);
    margin-bottom: 4px;
}

.pbm-timeline-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--pbm-gray-800);
    margin-bottom: 4px;
}

.pbm-timeline-description {
    font-size: 13px;
    color: var(--pbm-gray-600);
}

/* Progress Steps */
.pbm-progress-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 32px;
    position: relative;
}

.pbm-progress-steps::before {
    content: "";
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--pbm-gray-200);
    z-index: 0;
}

.pbm-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
    flex: 1;
}

.pbm-progress-step-marker {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--pbm-gray-300);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: var(--pbm-gray-500);
    margin-bottom: 12px;
}

.pbm-progress-step.pbm-step-completed .pbm-progress-step-marker {
    background: var(--pbm-success);
    border-color: var(--pbm-success);
    color: white;
}

.pbm-progress-step.pbm-step-active .pbm-progress-step-marker {
    background: var(--pbm-primary);
    border-color: var(--pbm-primary);
    color: white;
}

.pbm-progress-step-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--pbm-gray-500);
    text-align: center;
    max-width: 100px;
}

.pbm-progress-step.pbm-step-completed .pbm-progress-step-label,
.pbm-progress-step.pbm-step-active .pbm-progress-step-label {
    color: var(--pbm-gray-800);
}

@media (max-width: 768px) {
    .pbm-progress-steps {
        flex-wrap: wrap;
        gap: 20px;
    }
    
    .pbm-progress-steps::before {
        display: none;
    }
    
    .pbm-progress-step {
        flex: 0 0 calc(33.333% - 14px);
    }
}

/* Request Cards */
.pbm-request-card {
    background: white;
    border: 1px solid var(--pbm-gray-200);
    border-radius: var(--pbm-radius-lg);
    padding: 20px;
    margin-bottom: 16px;
    transition: var(--pbm-transition);
}

.pbm-request-card:hover {
    box-shadow: var(--pbm-shadow-md);
    border-color: var(--pbm-gray-300);
}

.pbm-request-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.pbm-request-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--pbm-gray-800);
    margin: 0 0 4px 0;
}

.pbm-request-card-ref {
    font-size: 13px;
    color: var(--pbm-gray-500);
    font-family: monospace;
}

.pbm-request-card-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
}

.pbm-request-card-field {
    font-size: 13px;
}

.pbm-request-card-field-label {
    color: var(--pbm-gray-500);
    margin-bottom: 2px;
}

.pbm-request-card-field-value {
    color: var(--pbm-gray-800);
    font-weight: 500;
}

.pbm-request-card-footer {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--pbm-gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Notifications */
.pbm-notifications-list {
    max-height: 400px;
    overflow-y: auto;
}

.pbm-notification-item {
    display: flex;
    gap: 12px;
    padding: 14px;
    border-bottom: 1px solid var(--pbm-gray-100);
    transition: var(--pbm-transition);
}

.pbm-notification-item:last-child {
    border-bottom: none;
}

.pbm-notification-item:hover {
    background: var(--pbm-gray-50);
}

.pbm-notification-item.pbm-unread {
    background: rgba(99, 91, 255, 0.05);
}

.pbm-notification-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.pbm-notification-content {
    flex: 1;
    min-width: 0;
}

.pbm-notification-message {
    font-size: 14px;
    color: var(--pbm-gray-700);
    margin-bottom: 4px;
}

.pbm-notification-time {
    font-size: 12px;
    color: var(--pbm-gray-500);
}

/* Alerts */
.pbm-alert {
    padding: 16px 20px;
    border-radius: var(--pbm-radius);
    margin-bottom: 20px;
    font-size: 14px;
}

.pbm-alert-success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: #15803d;
}

.pbm-alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #b91c1c;
}

.pbm-alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    color: #b45309;
}

.pbm-alert-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.2);
    color: #1d4ed8;
}

/* Instructions Panel */
.pbm-instructions-panel {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--pbm-radius-lg);
    padding: 32px;
    color: white;
    margin-bottom: 24px;
}

.pbm-instructions-panel h2 {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 8px 0;
}

.pbm-instructions-panel .pbm-instructions-subtitle {
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 24px;
}

.pbm-instructions-content {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: var(--pbm-radius);
    padding: 20px;
}

.pbm-instructions-content p {
    margin: 0 0 12px 0;
    line-height: 1.7;
}

.pbm-instructions-content p:last-child {
    margin-bottom: 0;
}

.pbm-instructions-ref {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.2);
    padding: 12px 20px;
    border-radius: var(--pbm-radius);
    margin-top: 16px;
}

.pbm-instructions-ref code {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 1px;
}

.pbm-instructions-ref .pbm-copy-btn {
    background: white;
    color: var(--pbm-primary);
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
}

/* File Upload */
.pbm-file-upload {
    border: 2px dashed var(--pbm-gray-300);
    border-radius: var(--pbm-radius);
    padding: 40px 20px;
    text-align: center;
    transition: var(--pbm-transition);
    cursor: pointer;
}

.pbm-file-upload:hover {
    border-color: var(--pbm-primary);
    background: rgba(99, 91, 255, 0.02);
}

.pbm-file-upload.pbm-dragover {
    border-color: var(--pbm-primary);
    background: rgba(99, 91, 255, 0.05);
}

.pbm-file-upload-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.pbm-file-upload-text {
    font-size: 14px;
    color: var(--pbm-gray-600);
    margin-bottom: 8px;
}

.pbm-file-upload-hint {
    font-size: 12px;
    color: var(--pbm-gray-500);
}

.pbm-file-upload input[type="file"] {
    display: none;
}

.pbm-file-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--pbm-gray-50);
    border-radius: var(--pbm-radius);
    margin-top: 12px;
}

.pbm-file-preview-name {
    flex: 1;
    font-size: 13px;
    color: var(--pbm-gray-700);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pbm-file-preview-remove {
    color: var(--pbm-danger);
    cursor: pointer;
    padding: 4px;
}

/* Empty States */
.pbm-empty-state {
    text-align: center;
    padding: 60px 20px;
}

.pbm-empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.pbm-empty-state-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--pbm-gray-800);
    margin-bottom: 8px;
}

.pbm-empty-state-text {
    font-size: 14px;
    color: var(--pbm-gray-500);
    margin-bottom: 20px;
}

/* Disclaimer */
.pbm-disclaimer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--pbm-gray-800);
    color: white;
    padding: 12px 20px;
    font-size: 12px;
    text-align: center;
    z-index: 100;
}

.pbm-disclaimer p {
    margin: 0;
    opacity: 0.9;
}

/* Loading States */
.pbm-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.pbm-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--pbm-gray-200);
    border-top-color: var(--pbm-primary);
    border-radius: 50%;
    animation: pbm-spin 0.8s linear infinite;
}

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

/* Pagination */
.pbm-pagination {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 24px;
}

.pbm-pagination-btn {
    padding: 8px 14px;
    font-size: 14px;
    border: 1px solid var(--pbm-gray-300);
    border-radius: var(--pbm-radius);
    background: white;
    color: var(--pbm-gray-700);
    cursor: pointer;
    transition: var(--pbm-transition);
}

.pbm-pagination-btn:hover {
    background: var(--pbm-gray-50);
    border-color: var(--pbm-gray-400);
}

.pbm-pagination-btn.active {
    background: var(--pbm-primary);
    border-color: var(--pbm-primary);
    color: white;
}

/* Responsive */
@media (max-width: 768px) {
    .pbm-container {
        padding: 20px 16px;
    }
    
    .pbm-page-header h1 {
        font-size: 22px;
    }
    
    .pbm-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .pbm-stat-card {
        padding: 16px;
    }
    
    .pbm-stat-card .pbm-stat-value {
        font-size: 24px;
    }
    
    .pbm-section-body {
        padding: 16px;
    }
    
    .pbm-instructions-panel {
        padding: 20px;
    }
    
    .pbm-table th,
    .pbm-table td {
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* Print Styles */
@media print {
    .pbm-disclaimer,
    .pbm-btn,
    .pbm-file-upload {
        display: none;
    }
    
    .pbm-container {
        padding: 0;
    }
    
    .pbm-section {
        border: 1px solid #ddd;
        break-inside: avoid;
    }
}

/* Utility Classes */
.pbm-text-center {
    text-align: center;
}

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

.pbm-text-muted {
    color: var(--pbm-gray-500);
}

.pbm-mt-0 { margin-top: 0; }
.pbm-mt-1 { margin-top: 8px; }
.pbm-mt-2 { margin-top: 16px; }
.pbm-mt-3 { margin-top: 24px; }
.pbm-mt-4 { margin-top: 32px; }

.pbm-mb-0 { margin-bottom: 0; }
.pbm-mb-1 { margin-bottom: 8px; }
.pbm-mb-2 { margin-bottom: 16px; }
.pbm-mb-3 { margin-bottom: 24px; }
.pbm-mb-4 { margin-bottom: 32px; }

.pbm-hidden {
    display: none;
}
