:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #10b981;
    --accent: #f59e0b;
    --danger: #ef4444;
    --success: #22c55e;
    --background: #0f172a;
    --surface: #1e293b;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, var(--background) 0%, #1e1b4b 100%);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
}

.header {
    text-align: center;
    margin-bottom: 3rem;
    padding: 2rem 0;
}

.header h1 {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.header p {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

.demo-section {
    background: var(--surface);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.demo-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.demo-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.feature-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2);
}

.feature-card h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--primary);
}

.feature-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.button-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.demo-sequence {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.sequence-step {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    min-height: 80px;
}

.sequence-step:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: translateX(4px);
}

.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.sequence-step .btn {
    flex: 1;
    margin: 0;
    min-width: 0;
    white-space: nowrap;
}

.btn {
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 56px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary), #059669);
    color: white;
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(16, 185, 129, 0.4);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), #d97706);
    color: white;
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(245, 158, 11, 0.4);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
    background: linear-gradient(135deg, #6b7280, #4b5563) !important;
    color: #9ca3af !important;
    border: 1px solid #4b5563;
}

.disabled-reason {
    font-size: 0.875rem;
    font-weight: 400;
    color: #9ca3af;
    font-style: italic;
    margin-left: 0.5rem;
}

.btn.loading {
    background: linear-gradient(135deg, var(--accent), #d97706);
    animation: pulse 1.5s infinite;
}

.btn.success {
    background: linear-gradient(135deg, var(--success), #16a34a);
    transform: scale(1.05);
}

.btn.error {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    transform: scale(1.05);
}

.btn-status-icon {
    margin-left: 0.5rem;
    font-weight: bold;
    font-size: 1.1rem;
    animation: fadeIn 0.3s ease-in;
}

.btn-status-icon.success {
    color: var(--success);
}

.btn-status-icon.error {
    color: var(--danger);
}

.status-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.02);
}

.status-icon {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

.status-icon.success {
    background: var(--success);
    color: white;
}

.status-icon.pending {
    background: var(--accent);
    color: white;
}

.status-icon.error {
    background: var(--danger);
    color: white;
}

.status-text {
    flex: 1;
    font-size: 0.9rem;
}

.status-detail {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.log-section {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85rem;
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border);
}

.log-entry {
    margin-bottom: 0.5rem;
    padding: 0.25rem 0;
}

.log-entry.info { color: var(--primary); }
.log-entry.success { color: var(--success); }
.log-entry.warning { color: var(--accent); }
.log-entry.error { color: var(--danger); }

.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.tech-tag {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

.qr-container {
    text-align: center;
    margin: 1rem 0;
}

.qr-code {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    display: inline-block;
    margin: 1rem 0;
}

@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .button-grid {
        grid-template-columns: 1fr;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
    }
    
    .demo-sequence {
        max-width: 100%;
    }
    
    .sequence-step {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
        min-height: auto;
    }
    
    .sequence-step .btn {
        width: 100%;
        white-space: normal;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    .button-grid {
        grid-template-columns: 1fr;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
    }
    
    .demo-sequence {
        max-width: 100%;
    }
    
    .sequence-step {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
        min-height: auto;
    }
    
    .sequence-step .btn {
        width: 100%;
        white-space: normal;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.modal-content {
    background-color: var(--surface);
    margin: 20px auto;
    padding: 0;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: calc(100vh - 40px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    border-radius: 16px 16px 0 0;
    flex-shrink: 0;
}

.modal-header h3 {
    margin: 0;
    color: var(--text);
}

.close {
    color: var(--text-muted);
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: var(--text);
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    resize: vertical;
    transition: border-color 0.3s ease;
}

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

.response-box {
    min-height: 100px;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.85rem;
    line-height: 1.4;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.response-box.success {
    border-color: var(--success);
    background: rgba(34, 197, 94, 0.05);
}

.response-box.error {
    border-color: var(--error);
    background: rgba(239, 68, 68, 0.05);
}

.response-box.info {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
}

.request-response-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.request-response-grid .form-group {
    margin-bottom: 0;
}

@media (max-width: 768px) {
    .request-response-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        margin: 10px auto;
        width: 95%;
        max-height: calc(100vh - 20px);
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
    
    .modal-footer {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
    border-radius: 0 0 16px 16px;
    flex-shrink: 0;
}

.footer {
    background: var(--surface);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    text-align: center;
}

.footer-content {
    max-width: 500px;
    margin: 0 auto;
}

.footer-content p {
    color: var(--text-muted);
    margin-bottom: 1rem;
    font-size: 1rem;
}

.github-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 1px solid var(--border);
}

.github-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.3);
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}

.github-link:active {
    transform: translateY(0);
}

/* Signature sharing styles */
.signature-container {
  margin: 2rem 0;
  padding: 1.5rem;
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  border-radius: 12px;
  border: 1px solid #dee2e6;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.signature-container h3 {
  margin: 0 0 1rem 0;
  color: var(--primary);
  font-size: 1.25rem;
  font-weight: 600;
}

.signature-container canvas {
  display: block;
  margin: 0 auto;
  cursor: crosshair;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#reset-signature {
  transition: all 0.2s ease;
}

#reset-signature:hover {
  background: #c82333 !important;
  transform: translateY(-1px);
}

/* Mobile-specific signature styles */
#signature-canvas-mobile canvas {
  touch-action: none; /* Prevent scrolling while drawing on mobile */
}

/* Desktop-specific signature styles */
#signature-canvas-desktop canvas {
  border: 2px solid #28a745 !important;
  background: #f8fff9 !important;
}