/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
    width: 100%;
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 50%, #1e3a8a 100%);
    padding: 1rem;
    animation: fadeIn 0.3s ease-in-out;
}

.screen.active {
    display: flex;
}

#screen-receipt.active {
    background: linear-gradient(135deg, #065f46 0%, #047857 50%, #065f46 100%);
}

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

/* Container */
.container {
    width: 100%;
    max-width: 480px;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem 0;
}

/* Card */
.card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    overflow: hidden;
}

.card-header {
    padding: 2rem 2rem 1rem;
    text-align: center;
}

.card-header.success {
    padding: 2rem;
}

.card-body {
    padding: 1rem 2rem 2rem;
}

.card-body.centered {
    text-align: center;
    padding: 3rem 2rem;
}

/* Logo & Icons */
.logo-circle {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
}

.success-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #10b981, #059669);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
}

.icon-small {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.icon-medium {
    width: 32px;
    height: 32px;
    stroke: currentColor;
}

.icon-large {
    width: 48px;
    height: 48px;
    stroke: white;
}

.icon-xlarge {
    width: 48px;
    height: 48px;
    stroke: white;
}

/* Typography */
.title {
    font-size: 2rem;
    font-weight: 700;
    color: #1e40af;
    margin-bottom: 0.5rem;
}

.title-medium {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e40af;
    margin-top: 1rem;
    text-align: center;
}

.title-success {
    font-size: 1.5rem;
    font-weight: 700;
    color: #047857;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: #6b7280;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.input-group {
    display: flex;
    align-items: center;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    background: white;
    transition: border-color 0.2s;
}

.input-group:focus-within {
    border-color: #2563eb;
    outline: none;
}

.input-prefix {
    color: #6b7280;
    margin-right: 0.5rem;
    font-size: 1.5rem;
}

.input-large {
    border: none;
    outline: none;
    font-size: 1.5rem;
    font-weight: 700;
    width: 100%;
    color: #111827;
}

.input-helper {
    display: block;
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
    min-height: 18px;
}

/* Buttons */
.btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
    text-decoration: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #1d4ed8, #1e40af);
}

.btn-primary:disabled {
    background: #e5e7eb;
    color: #9ca3af;
    cursor: not-allowed;
}

.btn-outline {
    background: white;
    color: #374151;
    border: 2px solid #e5e7eb;
}

.btn-outline:hover {
    background: #f9fafb;
    border-color: #d1d5db;
}

.btn-large {
    margin-bottom: 0.75rem;
}

.btn-back {
    background: transparent;
    border: none;
    color: #374151;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    transition: color 0.2s;
}

.btn-back:hover {
    color: #1e40af;
}

/* Amount Display */
.amount-display {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 2rem;
}

.amount-display-small {
    background: #f3f4f6;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    margin-bottom: 2rem;
}

.amount-label {
    color: #6b7280;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.amount-value {
    font-size: 2rem;
    font-weight: 700;
    color: #1e40af;
}

.amount-value-small {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
}

.amount-huge {
    font-size: 2.5rem;
    font-weight: 700;
    color: #111827;
}

/* Payment Options */
.payment-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.payment-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s;
}

.payment-card:hover {
    background: #f9fafb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.payment-card:active {
    transform: translateY(0);
}

.payment-debit {
    border-color: #2563eb;
}

.payment-debit:hover {
    background: #eff6ff;
}

.payment-credit {
    border-color: #9333ea;
}

.payment-credit:hover {
    background: #faf5ff;
}

.payment-card-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.payment-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.payment-icon-debit {
    background: #dbeafe;
    color: #2563eb;
}

.payment-icon-credit {
    background: #f3e8ff;
    color: #9333ea;
}

.payment-info {
    text-align: left;
}

.payment-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.25rem;
}

.payment-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
}

.payment-arrow {
    font-size: 1.5rem;
    color: #9ca3af;
    transition: transform 0.2s;
}

.payment-card:hover .payment-arrow {
    transform: translateX(4px);
}

/* PIN Entry */
.pin-dots {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.pin-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    background: white;
    transition: all 0.2s;
}

.pin-dot.active {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-color: #2563eb;
}

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

.key-btn {
    aspect-ratio: 1;
    background: #f3f4f6;
    border: none;
    border-radius: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.key-btn:hover {
    background: #e5e7eb;
}

.key-btn:active {
    transform: scale(0.95);
    background: #d1d5db;
}

.key-delete {
    background: #fee2e2;
    color: #dc2626;
}

.key-delete:hover {
    background: #fecaca;
}

.key-empty {
    background: transparent;
    cursor: default;
}

.key-empty:hover {
    background: transparent;
}

/* Processing Animation */
.processing-animation {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 2rem;
}

.spinner-circle {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.spinner-circle .icon-large {
    stroke: #2563eb;
}

.spinner {
    width: 120px;
    height: 120px;
    border: 3px solid #e5e7eb;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.processing-steps {
    margin-top: 2rem;
    text-align: left;
    max-width: 280px;
    margin-left: auto;
    margin-right: auto;
}

.processing-step {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    color: #6b7280;
    font-size: 0.875rem;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    background: #2563eb;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* Receipt */
.receipt-container {
    background: #f9fafb;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.receipt-amount {
    text-align: center;
    margin-bottom: 1.5rem;
}

.receipt-divider {
    height: 1px;
    background: #e5e7eb;
    margin: 1.5rem 0;
}

.receipt-details {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.receipt-row span {
    color: #6b7280;
}

.receipt-row strong {
    color: #111827;
    font-weight: 600;
}

/* Transaction History */
.transaction-list {
    max-height: 500px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.transaction-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: box-shadow 0.2s;
}

.transaction-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.transaction-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.transaction-amount {
    font-size: 1.125rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.25rem;
}

.transaction-datetime {
    font-size: 0.75rem;
    color: #6b7280;
}

.transaction-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.transaction-badge.success {
    background: #d1fae5;
    color: #065f46;
}

.transaction-badge.failed {
    background: #fee2e2;
    color: #991b1b;
}

.transaction-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.transaction-method {
    font-size: 0.875rem;
    color: #6b7280;
}

.transaction-id {
    font-size: 0.75rem;
    color: #9ca3af;
    font-family: monospace;
}

.transaction-summary {
    background: #f9fafb;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1.5rem;
}

.empty-state {
    padding: 3rem 1rem;
    text-align: center;
    color: #6b7280;
}

/* Terminal Info */
.terminal-info {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

.info-text {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-bottom: 0.25rem;
}

.info-text.centered {
    text-align: center;
    margin-top: 1rem;
}

/* Responsive Design */
@media (max-width: 640px) {
    .container {
        padding: 0;
    }

    .card {
        border-radius: 0;
        min-height: 100vh;
    }

    .card-body {
        padding: 1rem 1.5rem 2rem;
    }

    .amount-huge {
        font-size: 2rem;
    }

    .title {
        font-size: 1.75rem;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }

    .screen {
        background: white;
        padding: 0;
    }

    .btn, .btn-back {
        display: none;
    }

    .card {
        box-shadow: none;
    }
}
