/* Modern, clean styling for PDF Bank Statement Reader PWA */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

header h1 {
    font-size: 24px;
    font-weight: 600;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.license-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tier {
    padding: 4px 12px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 14px;
}

.tier-PRO {
    background: #10b981;
    color: white;
}

.tier-STD {
    background: #3b82f6;
    color: white;
}

.tier-FRE {
    background: #6b7280;
    color: white;
}

.tier-none {
    background: #ef4444;
    color: white;
}

main {
    padding: 30px;
}

.ruleset-section {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.ruleset-section label {
    font-weight: 500;
}

.ruleset-section select {
    padding: 8px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    min-width: 200px;
    background: white;
}

.ruleset-section select:focus {
    outline: none;
    border-color: #2563eb;
}

.upload-section {
    margin-bottom: 25px;
}

.drop-zone {
    border: 3px dashed #cbd5e1;
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    background: #f8fafc;
    transition: all 0.3s ease;
    cursor: pointer;
}

.drop-zone:hover {
    border-color: #2563eb;
    background: #eff6ff;
}

.drop-zone.dragover {
    border-color: #2563eb;
    background: #dbeafe;
    transform: scale(1.02);
}

.drop-zone p {
    margin: 10px 0;
    color: #64748b;
    font-size: 16px;
}

.drop-zone-or {
    font-size: 14px;
    color: #94a3b8;
}

.status-section {
    margin-top: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.status {
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 14px;
}

.status.ready {
    background: #d1fae5;
    color: #065f46;
}

.status.processing {
    background: #fef3c7;
    color: #92400e;
}

.status.success {
    background: #d1fae5;
    color: #065f46;
}

.status.error {
    background: #fee2e2;
    color: #991b1b;
}

.status.validating {
    background: #dbeafe;
    color: #1e40af;
}

.console-section {
    margin-top: 30px;
}

.console-section h2 {
    font-size: 18px;
    margin-bottom: 10px;
    color: #1e293b;
}

.console-output {
    background: #1e293b;
    color: #e2e8f0;
    padding: 20px;
    border-radius: 8px;
    max-height: 400px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
}

.log-message {
    margin-bottom: 8px;
}

.log-info {
    color: #cbd5e1;
}

.log-success {
    color: #86efac;
}

.log-error {
    color: #fca5a5;
}

.log-warning {
    color: #fde047;
}

.log-message a {
    color: #93c5fd;
    text-decoration: underline;
    cursor: pointer;
}

.log-message a:hover {
    color: #60a5fa;
}

.log-message details {
    margin: 8px 0;
}

.log-message details summary {
    cursor: pointer;
    color: #60a5fa;
    font-weight: 500;
    user-select: none;
}

.log-message details summary:hover {
    color: #3b82f6;
    text-decoration: underline;
}

.log-message details pre {
    background: #f1f5f9;
    padding: 10px;
    border-radius: 4px;
    overflow-x: auto;
    max-height: 200px;
    font-size: 11px;
    font-family: 'Courier New', monospace;
    white-space: pre-wrap;
    word-wrap: break-word;
    border: 1px solid #e2e8f0;
    margin-top: 5px;
    color: #000000;
}

/* Buttons */
.btn-primary, .btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background: #2563eb;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

/* Ruleset Management Styles */
.ruleset-manager-section h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #1e293b;
}

.ruleset-select-container {
    margin-bottom: 15px;
}

.ruleset-select-container .input-field {
    margin-bottom: 0;
}

.rules-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin-bottom: 8px;
    background: #f8fafc;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
}

.rules-list-item:hover {
    background: #f1f5f9;
}

/* Rule Editor Dialog (nested modal) */
#rule-editor-dialog {
    z-index: 10001;
}

#rule-editor-dialog .modal-content {
    position: relative;
    z-index: 10002;
}

/* Modal (License Dialog) */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 12px;
    max-width: 500px;
    max-height: 85vh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideDown 0.3s ease;
    display: flex;
    flex-direction: column;
}

.modal-scrollable-content {
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    padding-right: 5px; /* Space for scrollbar */
}

@keyframes slideDown {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    margin-bottom: 15px;
    color: #1e293b;
}

.close-btn {
    transition: color 0.2s ease;
}

.close-btn:hover {
    color: #1e293b;
}

.close-btn:active {
    color: #000;
}

.modal-content p {
    margin-bottom: 20px;
    color: #64748b;
}

.input-field {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 15px;
}

.input-field:focus {
    outline: none;
    border-color: #2563eb;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.license-info-text {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
    font-size: 13px;
    color: #64748b;
}

.license-info-text p {
    margin-bottom: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .ruleset-section {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .ruleset-section select {
        width: 100%;
    }
    
    .modal-content {
        margin: 20% auto;
        padding: 20px;
        max-width: 90%;
    }
}

/* Scrollbar styling */
.console-output::-webkit-scrollbar {
    width: 8px;
}

.console-output::-webkit-scrollbar-track {
    background: #0f172a;
}

.console-output::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

.console-output::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

