/* Standardized Main CSS - Consistent fonts and colors */
* { 
    box-sizing: border-box; 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0;
    padding: 2%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow-x: hidden;
    color: #2c3e50;
}

.container {
    width: 100%;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}

.content { 
    padding: 2%; 
    width: 100%;
    max-width: 1200px;
    box-sizing: border-box;
    margin: 0 auto;
}

/* Page Header */
.page-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 24px 32px;
    text-align: center;
    border-radius: 15px 15px 0 0;
    width: 100%;
    box-sizing: border-box;
}

.page-title {
    margin: 0 auto;
    font-size: 2em;
    font-weight: 600;
    letter-spacing: -0.5px;
    color: white;
    width: 100%;
    text-align: center;
}

@media (max-width: 768px) {
    .page-header { padding: 20px 16px; border-radius: 10px 10px 0 0; width: 100%; }
    .page-title { font-size: 1.5em; width: 100%; }
}

/* Buttons */
.btn {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: inline-block;
    transition: all 0.3s ease;
    max-width: 100%;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px;
    -webkit-touch-callout: none;
}

.btn:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4); }
.btn-success { background: linear-gradient(135deg, #27ae60 0%, #229954 100%); }
.btn-danger { background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%); }

/* Forms */
input, select, textarea, .form-group input, .form-group select { 
    width: 100%; 
    max-width: 100%; 
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.form-group { margin-bottom: 25px; width: 100%; }
.form-group label { 
    display: block; 
    margin-bottom: 8px; 
    font-weight: 600; 
    color: #2c3e50;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.form-group input, .form-group select {
    padding: 12px;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    font-size: 16px;
    color: #2c3e50;
}
.form-group input:focus, .form-group select:focus { 
    outline: none; 
    border-color: #3498db; 
}
.form-group small { 
    color: #7f8c8d; 
    font-size: 12px; 
    margin-top: 5px; 
    display: block; 
    word-break: break-word;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.form-group button { width: 100%; margin-top: 8px; }

/* Cards & Tables */
.card-container {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0 auto;
}

.invoice-details {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    display: block;
    margin: 0 auto;
}

.invoice-details h3 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 1.4em;
    font-weight: 600;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    text-align: left;
}

.info-header { 
    color: #2c3e50; 
    margin: 0 0 16px 0; 
    font-size: 1.2em; 
    font-weight: 600;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    text-align: left;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 auto 10px auto;
    padding: 8px 0;
    border-bottom: 1px solid #ecf0f1;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.detail-label { 
    font-weight: 600; 
    color: #7f8c8d; 
    min-width: 120px; 
    flex-shrink: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    text-align: left;
}
.detail-value { 
    color: #2c3e50; 
    word-break: break-word; 
    overflow-wrap: break-word; 
    flex: 1; 
    min-width: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    text-align: left;
}

/* Key-Value Component */
.key-value-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 8px 0;
    border-bottom: 1px solid #ecf0f1;
    gap: 12px;
    box-sizing: border-box;
}

.key-value-key {
    font-weight: 600;
    color: #7f8c8d;
    text-align: left;
    flex-shrink: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.key-value-value {
    color: #2c3e50;
    text-align: right;
    flex: 1;
    word-break: break-word;
    overflow-wrap: break-word;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.info-table {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
    margin: 0 auto;
}

.info-table td {
    padding: 8px 4px;
    word-break: break-word;
    overflow-wrap: break-word;
    max-width: 0;
    color: #2c3e50;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    text-align: left;
    vertical-align: top;
}

.info-table td:first-child { width: 35%; font-weight: 600; color: #7f8c8d; }
.info-table td:last-child { width: 65%; }

/* Utilities */
.text-primary { color: #2c3e50; }
.text-muted { color: #7f8c8d; }
.text-success { color: #28a745; }

.font-small { font-size: 12px; }
.font-normal { font-size: 14px; }
.font-medium { font-size: 16px; }
.font-large { font-size: 24px; }
.mono { font-family: 'Courier New', Courier, monospace; }

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }

/* Components */
.search-bar {
    margin: 0 auto 20px auto;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.search-bar form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search-bar input {
    flex: 1;
    min-width: 200px;
    padding: 10px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    max-width: 100%;
    color: #2c3e50;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.wallet-connect-section { 
    text-align: center; 
    width: 100%;
    margin: 0 auto;
    display: block !important;
    visibility: visible !important;
}

.wallet-connect-section h4,
.wallet-connect-section p {
    text-align: center;
}
.wallet-qr-container { 
    display: flex; 
    justify-content: center; 
    align-items: center; 
    flex-direction: column; 
    max-width: 100%; 
    visibility: visible !important;
}
.wallet-qr-code { 
    display: inline-block; 
    max-width: 100%; 
    visibility: visible !important;
}

.loading-spinner {
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.exec-button { 
    padding: 0; 
    background: transparent; 
    border: none; 
    width: 100%;
    margin: 0 auto;
}
.exec-button .btn { 
    width: 100%; 
    max-width: 100%; 
    display: block;
    margin: 0 auto;
}
.exec-log { 
    padding: 0; 
    background: transparent; 
    border: none; 
    width: 100%;
    margin: 0 auto;
}

.exec-log-content {
    background: #f8f9fa;
    padding: 16px;
    border-radius: 12px;
    text-align: left;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    min-height: 60px;
    border: 1px solid #e9ecef;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    word-break: break-word;
    overflow-wrap: break-word;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: auto;
    color: #2c3e50;
    margin: 0 auto;
}

.error-box {
    display: none;
    background: #fdf2f2;
    border: 1px solid #f5c6cb;
    color: #721c24;
    border-radius: 12px;
    padding: 16px;
    margin: 16px auto;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    text-align: left;
}

.error-box h3 { 
    margin: 0 0 8px 0; 
    font-size: 1.1em; 
    font-weight: 600;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.error-box p { 
    margin: 0; 
    word-break: break-word;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.status-issued { background-color: #fff3cd; color: #856404; }
.status-paid { background-color: #d4edda; color: #155724; }
.status-cancelled { background-color: #f8d7da; color: #721c24; }
.status-expired { background-color: #e2e3e5; color: #383d41; }
.status-unknown { background-color: #f8f9fa; color: #6c757d; }

/* Global word-break */
p, span, div, td, th, label, a { 
    word-break: break-word; 
    overflow-wrap: break-word; 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #2c3e50;
}
img, canvas { 
    max-width: 100%; 
    height: auto; 
    display: block; 
    margin: 0 auto;
}
button, input, select, textarea { 
    max-width: 100%; 
    width: 100%;
    box-sizing: border-box;
}

/* Result message styling */
.result {
    width: 100%;
    max-width: 100%;
    margin: 16px 0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.result.success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
}

.result.error {
    background: white;
    border: 1px solid #dc3545;
}

.result h3 {
    margin: 0;
    padding: 16px;
    font-size: 1.2em;
    font-weight: bold;
    word-break: break-word;
}

.result .error-box {
    margin: 0;
    padding: 20px;
    border-radius: 0;
    background: #fdf2f2;
}

.result .error-box p {
    margin: 8px 0;
    word-break: break-word;
    font-size: 0.95em;
}

/* Responsive */
@media (max-width: 768px) {
    body { padding: 8px; }
    .container { width: 100%; margin: 0 auto; border-radius: 10px; }
    .content { padding: 16px; width: 100%; max-width: 100%; }
    .card-container, .invoice-details { padding: 16px !important; width: 100%; max-width: 100%; margin: 0 auto; }
    .detail-row { flex-direction: column !important; align-items: flex-start !important; gap: 8px !important; width: 100%; }
    .detail-label { min-width: auto !important; width: 100%; margin-bottom: 4px; text-align: left; }
    .detail-value { width: 100%; text-align: left; }
    .key-value-row { flex-direction: column !important; align-items: flex-start !important; gap: 4px !important; }
    .key-value-key { width: 100%; }
    .key-value-value { width: 100%; text-align: left !important; }
    .info-table tr { display: block; margin-bottom: 12px; border-bottom: 1px solid #ecf0f1; padding-bottom: 8px; width: 100%; }
    .info-table td { display: block; width: 100% !important; padding: 4px 0; text-align: left; }
    .info-table td:first-child { font-weight: 600; color: #7f8c8d; margin-bottom: 4px; text-align: left; }
    .btn, .form-group button { padding: 12px 20px; min-height: 44px; width: 100%; margin: 0 auto; display: block; text-align: center; }
    .form-group input, .form-group select, .form-group textarea { font-size: 16px; width: 100%; }
    .exec-log-content { 
        font-size: 14px; 
        padding: 12px; 
        width: 100%; 
        text-align: left;
        word-break: break-word;
        overflow-wrap: break-word;
        max-height: 300px;
        overflow-y: auto;
    }
    .page-title { font-size: 1.5em; width: 100%; }
    .error-box { width: 100%; margin: 16px auto; text-align: left; }
    .result { width: 100%; margin: 16px 0; }
    .result h3 { font-size: 1.1em; padding: 12px; }
    .result .error-box { padding: 16px; }
    .result .error-box p { font-size: 0.9em; margin: 6px 0; }
}
