/* ===========================
   FluidPay Payment Terminal
   Main Stylesheet
   =========================== */

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --success-color: #16a34a;
    --error-color: #dc2626;
    --warning-color: #f59e0b;
    --debit-color: #16a34a;
    --credit-color: #2563eb;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-primary: #f3f4f6;
    --bg-card: #ffffff;
    --border-color: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
}

/* ===========================
   Navbar
   =========================== */

.navbar {
    background: var(--bg-card);
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo {
    font-size: 1.5rem;
}

.brand-text {
    font-weight: 600;
    font-size: 1.125rem;
}

.navbar-menu {
    display: flex;
    gap: 1rem;
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-name {
    font-weight: 500;
}

.user-role {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.logout-btn {
    color: var(--error-color);
    text-decoration: none;
    padding: 0.375rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
}

.logout-btn:hover {
    background: rgba(220, 38, 38, 0.1);
}

/* ===========================
   Main Content
   =========================== */

.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* ===========================
   Flash Messages
   =========================== */

.flash-messages {
    margin-bottom: 1.5rem;
}

.flash-message {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.flash-error {
    background: #fef2f2;
    color: var(--error-color);
    border: 1px solid #fecaca;
}

.flash-success {
    background: #f0fdf4;
    color: var(--success-color);
    border: 1px solid #bbf7d0;
}

.flash-info {
    background: #eff6ff;
    color: var(--primary-color);
    border: 1px solid #bfdbfe;
}

.flash-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    opacity: 0.5;
}

.flash-close:hover {
    opacity: 1;
}

/* ===========================
   Login Page
   =========================== */

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.login-card {
    background: var(--bg-card);
    padding: 2.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    font-size: 3rem;
    display: block;
    margin-bottom: 0.5rem;
}

.login-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.login-header p {
    color: var(--text-secondary);
}

.login-form .form-group {
    margin-bottom: 1.25rem;
}

.login-btn {
    width: 100%;
    padding: 0.875rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.login-btn:hover {
    background: var(--primary-hover);
}

/* ===========================
   Terminal Page
   =========================== */

.terminal-container {
    max-width: 600px;
    margin: 0 auto;
}

.terminal-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.terminal-card h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

.form-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

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

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
}

.form-group label .required {
    color: var(--error-color);
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

/* Amount Input */
.amount-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.currency-symbol {
    position: absolute;
    left: 1rem;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.amount-input {
    padding-left: 2.5rem !important;
    font-size: 2rem !important;
    font-weight: 600;
    text-align: right;
}

/* BIN Status */
.bin-status {
    margin-top: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    display: none;
}

.bin-status.loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #fef3c7;
    color: #92400e;
}

.bin-status.success {
    display: block;
    background: #f0fdf4;
    color: var(--success-color);
}

.bin-status.error {
    display: block;
    background: #fef2f2;
    color: var(--error-color);
}

/* Processor Info */
.processor-info {
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.processor-info.hidden {
    display: none;
}

.processor-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-brand {
    font-weight: 600;
}

.card-type {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.card-type.debit {
    background: var(--debit-color);
    color: white;
}

.card-type.credit {
    background: var(--credit-color);
    color: white;
}

.fee-info {
    font-weight: 600;
}

/* Fee Summary */
.fee-summary {
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border: 2px solid #86efac;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.fee-summary.hidden {
    display: none;
}

.fee-summary h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    text-transform: none;
    letter-spacing: normal;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 1rem;
}

.summary-row.total {
    border-top: 2px solid #86efac;
    margin-top: 0.5rem;
    padding-top: 1rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--success-color);
}

/* Collapsible */
.collapsible-header {
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toggle-icon {
    transition: transform 0.2s;
}

.collapsible.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.collapsible.collapsed .collapsible-content {
    display: none;
}

/* Submit Button */
.submit-btn {
    width: 100%;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.125rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.submit-btn:hover {
    background: var(--primary-hover);
}

.submit-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

/* ===========================
   Receipt Page
   =========================== */

.receipt-container {
    max-width: 500px;
    margin: 0 auto;
}

.receipt-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

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

.receipt-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-weight: 600;
}

.receipt-status.success {
    background: #f0fdf4;
    color: var(--success-color);
}

.status-icon {
    font-size: 1.25rem;
}

.receipt-amount {
    text-align: center;
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 2rem;
}

.receipt-details {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

.receipt-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.receipt-row:last-child {
    border-bottom: none;
}

.receipt-row .label {
    color: var(--text-secondary);
}

.receipt-row .value {
    font-weight: 500;
}

.receipt-row.total-row {
    border-top: 2px solid var(--border-color);
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    background: #f0fdf4;
    margin-left: -1rem;
    margin-right: -1rem;
    padding-left: 1rem;
    padding-right: 1rem;
}

.receipt-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* ===========================
   History Page
   =========================== */

.history-container {
    max-width: 1000px;
    margin: 0 auto;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.history-header h2 {
    font-size: 1.5rem;
}

.filters-form {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-group label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.filter-group input {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-card);
    padding: 1.25rem;
    border-radius: 8px;
    box-shadow: var(--shadow);
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.table-container {
    background: var(--bg-card);
    border-radius: 8px;
    box-shadow: var(--shadow);
    overflow-x: auto;
}

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

.transactions-table th,
.transactions-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.transactions-table th {
    background: var(--bg-primary);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.transactions-table .amount {
    font-weight: 600;
}

.card-type-debit {
    color: var(--debit-color);
    font-weight: 500;
}

.card-type-credit {
    color: var(--credit-color);
    font-weight: 500;
}

.status-approved {
    color: var(--success-color);
    font-weight: 500;
}

.status-declined {
    color: var(--error-color);
    font-weight: 500;
}

.no-data {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem !important;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.page-info {
    color: var(--text-secondary);
}

/* ===========================
   Buttons
   =========================== */

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

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

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

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--border-color);
}

/* ===========================
   Email Toggle
   =========================== */

.email-toggle-group {
    margin-bottom: 1rem;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    font-weight: 500;
}

.toggle-label input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.toggle-text {
    font-size: 1rem;
}

/* ===========================
   Utilities
   =========================== */

.hidden {
    display: none !important;
}

/* ===========================
   Responsive
   =========================== */

/* Tablet breakpoint */
@media (max-width: 768px) {
    /* Navbar */
    .navbar {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
    }
    
    .navbar-brand {
        width: 100%;
        justify-content: center;
    }
    
    .navbar-menu {
        width: 100%;
        justify-content: center;
    }
    
    .navbar-user {
        width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .user-name, .user-role {
        font-size: 0.875rem;
    }
    
    /* Main Content */
    .main-content {
        padding: 1rem 0.75rem;
    }
    
    /* Terminal */
    .terminal-card {
        padding: 1.5rem;
    }
    
    .terminal-card h2 {
        font-size: 1.25rem;
    }
    
    /* Form rows - stack on tablet */
    .form-row {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    /* Amount input */
    .amount-input {
        font-size: 1.5rem !important;
    }
    
    .currency-symbol {
        font-size: 1.25rem;
    }
    
    /* History page */
    .history-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filters-form {
        flex-wrap: wrap;
        width: 100%;
    }
    
    .filter-group {
        flex: 1;
        min-width: 120px;
    }
    
    .filter-group input {
        width: 100%;
    }
    
    /* Stats row */
    .stats-row {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }
    
    .stat-card {
        padding: 0.75rem;
    }
    
    .stat-value {
        font-size: 1.25rem;
    }
    
    .stat-label {
        font-size: 0.75rem;
    }
    
    /* Table - make scrollable */
    .table-container {
        margin: 0 -0.75rem;
        border-radius: 0;
    }
    
    .transactions-table th,
    .transactions-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.875rem;
    }
    
    /* Receipt */
    .receipt-card {
        padding: 1.5rem;
    }
    
    .receipt-amount {
        font-size: 2.5rem;
    }
    
    .receipt-actions {
        flex-direction: column;
    }
    
    /* Processor info */
    .processor-info {
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    /* Fee summary */
    .fee-summary {
        padding: 1rem;
    }
    
    /* Login card */
    .login-card {
        padding: 1.5rem;
        margin: 0 0.5rem;
    }
    
    .login-logo {
        font-size: 2.5rem;
    }
    
    .login-header h1 {
        font-size: 1.25rem;
    }
}

/* Mobile breakpoint */
@media (max-width: 480px) {
    /* Navbar */
    .navbar {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }
    
    .brand-text {
        font-size: 1rem;
    }
    
    .logo {
        font-size: 1.25rem;
    }
    
    .navbar-menu {
        gap: 0.5rem;
    }
    
    .nav-link {
        padding: 0.375rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .navbar-user {
        font-size: 0.75rem;
    }
    
    .logout-btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    /* Main Content */
    .main-content {
        padding: 0.75rem 0.5rem;
    }
    
    /* Terminal */
    .terminal-container {
        max-width: 100%;
    }
    
    .terminal-card {
        padding: 1rem;
        border-radius: 8px;
    }
    
    .terminal-card h2 {
        font-size: 1.125rem;
        margin-bottom: 1rem;
    }
    
    .form-section {
        margin-bottom: 1rem;
        padding-bottom: 1rem;
    }
    
    .form-section h3 {
        font-size: 0.75rem;
        margin-bottom: 0.75rem;
    }
    
    .form-group {
        margin-bottom: 0.75rem;
    }
    
    .form-group label {
        font-size: 0.8125rem;
    }
    
    .form-group input {
        padding: 0.625rem;
        font-size: 1rem;
    }
    
    /* Amount input - smaller on mobile */
    .amount-input {
        font-size: 1.25rem !important;
        padding-left: 2rem !important;
    }
    
    .currency-symbol {
        font-size: 1rem;
        left: 0.75rem;
    }
    
    /* Submit button */
    .submit-btn {
        padding: 0.875rem;
        font-size: 1rem;
    }
    
    /* History page */
    .history-container {
        max-width: 100%;
    }
    
    .history-header h2 {
        font-size: 1.25rem;
    }
    
    .filters-form {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .filters-form .btn {
        width: 100%;
    }
    
    /* Stats row - stack on small mobile */
    .stats-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .stat-card {
        display: flex;
        justify-content: space-between;
        align-items: center;
        text-align: left;
    }
    
    .stat-value {
        font-size: 1.125rem;
        order: 2;
    }
    
    .stat-label {
        font-size: 0.875rem;
        order: 1;
    }
    
    /* Table - responsive card layout */
    .transactions-table {
        font-size: 0.8125rem;
    }
    
    .transactions-table th,
    .transactions-table td {
        padding: 0.5rem 0.375rem;
        white-space: nowrap;
    }
    
    /* Hide less important columns on mobile */
    .transactions-table th:nth-child(5),
    .transactions-table td:nth-child(5) {
        display: none;
    }
    
    /* Pagination */
    .pagination {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .pagination .btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    /* Receipt */
    .receipt-container {
        max-width: 100%;
    }
    
    .receipt-card {
        padding: 1rem;
        border-radius: 8px;
    }
    
    .receipt-header {
        margin-bottom: 1rem;
    }
    
    .receipt-status {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    
    .receipt-amount {
        font-size: 2rem;
        margin-bottom: 1.5rem;
    }
    
    .receipt-row {
        padding: 0.5rem 0;
        font-size: 0.875rem;
    }
    
    .receipt-row .label {
        font-size: 0.8125rem;
    }
    
    /* Login */
    .login-container {
        min-height: 70vh;
        padding: 1rem 0;
    }
    
    .login-card {
        padding: 1.25rem;
        margin: 0 0.5rem;
        border-radius: 8px;
    }
    
    .login-logo {
        font-size: 2rem;
    }
    
    .login-header h1 {
        font-size: 1.125rem;
    }
    
    .login-header p {
        font-size: 0.875rem;
    }
    
    .login-btn {
        padding: 0.75rem;
        font-size: 0.9375rem;
    }
    
    /* Buttons */
    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.9375rem;
    }
    
    /* Flash messages */
    .flash-message {
        padding: 0.75rem;
        font-size: 0.875rem;
    }
    
    /* Processor info */
    .processor-info {
        padding: 0.75rem;
        font-size: 0.875rem;
    }
    
    .card-type {
        font-size: 0.6875rem;
    }
    
    /* Fee summary */
    .fee-summary {
        padding: 0.75rem;
    }
    
    .fee-summary h3 {
        font-size: 0.875rem;
    }
    
    .summary-row {
        font-size: 0.875rem;
        padding: 0.375rem 0;
    }
    
    .summary-row.total {
        font-size: 1rem;
    }
    
    /* Customer signin card */
    .customer-signin-card {
        max-width: 100%;
    }
    
    .bypass-2fa-section {
        margin-top: 1rem;
        padding-top: 0.75rem;
    }
    
    .bypass-notice {
        font-size: 0.75rem;
    }
    
    .bypass-btn {
        padding: 0.625rem 1rem;
        font-size: 0.75rem;
    }
    
    /* Verification page */
    .verification-code-input {
        font-size: 1.5rem !important;
        letter-spacing: 0.3em;
    }
    
    .verification-info {
        font-size: 0.8125rem;
    }
}

/* ===========================
   Customer Sign-In Page
   =========================== */

.customer-signin-card {
    max-width: 450px;
}

.phone-input {
    font-size: 1.125rem;
    letter-spacing: 0.05em;
}

.form-help {
    display: block;
    margin-top: 0.375rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.admin-link {
    margin-top: 1.5rem;
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.admin-link a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
}

.admin-link a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Verification Page */
.verification-code-input {
    font-size: 2rem !important;
    text-align: center;
    letter-spacing: 0.5em;
    font-weight: 600;
}

.verification-info {
    margin-top: 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.verification-info a {
    color: var(--primary-color);
    text-decoration: none;
}

.verification-info a:hover {
    text-decoration: underline;
}

.code-expiry {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: var(--warning-color);
}

/* Bypass 2FA Section */
.bypass-2fa-section {
    margin-top: 1.5rem;
    text-align: center;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.bypass-notice {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.bypass-btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--warning-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.2s;
}

.bypass-btn:hover {
    background: #d97706;
}
