/* =========================================
   1. BASE STYLES & RESETS
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px 0;
}

/* =========================================
   2. LAYOUT COMPONENTS
   ========================================= */

/* Form Container */
.form-container {
    max-width: 600px;
    margin: 50px auto;
    padding: 20px;
    background-color: var(--input-bg);
    border-radius: 38px;
    box-shadow: var(--box-shadow);
    position: relative;
    overflow: hidden;
}

.form-container::before {
    content: "";
    position: absolute;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 5px;
    background-color: var(--border-color);
    border-radius: 3px;
    z-index: 10;
}

/* Logo Containers */
.bank-logo-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    margin-top: 15px;
    background-color: var(--input-bg);
    padding: 20px;
    border-radius: 8px;
}

.bank-logo-container img {
    max-width: 300px;
    height: auto;
    margin-bottom: 10px;
}

.idebit-logo-centered-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.idebit-logo-centered-container img {
    max-width: 100px;
    height: auto;
    margin-bottom: 20px;
}

/* Footer */
footer,
.footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px 0;
    color: #666;
    font-size: 0.9em;
    width: 100%;
}

footer p {
    margin: 0;
}

/* Light mode (default) */
.light-mode-image {
    display: block;
}

.dark-mode-image {
    display: none;
}

/* Dark mode via body class */
body.dark-mode .light-mode-image {
    display: none;
}

body.dark-mode .dark-mode-image {
    display: block;
}

/* =========================================
   3. TYPOGRAPHY
   ========================================= */

h1 {
    text-align: center;
    color: #333333;
    font-size: 1.75rem;
    margin-bottom: 20px;
}

/* =========================================
   4. FORM ELEMENTS
   ========================================= */

/* General Form Styling */
.form-group {
    position: relative;
    margin-bottom: 25px;
}

label {
    display: block;
    font-weight: bold;
    margin-bottom: 5px;
}

input[type='text'],
input[type='number'],
input[type='email'],
input[type='tel'],
input[type='password'],
select,
textarea {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 1px solid #cccccc;
    border-radius: 4px;
    color: #000;
    font-weight: 500;
    transition: border-color 0.3s ease;
}

textarea {
    min-height: 100px;
    resize: vertical;
    font-family: inherit;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.needs-detail {
    border-color: #0056b3;
    background-color: #f8f9ff;
}

/* Hide browser spinner buttons on number input */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
}

/* Checkbox Styling */
.checkbox-container {
    margin-top: 8px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-size: 0.9em;
    color: #555;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
}

.checkbox-text {
    user-select: none;
}

/* Button Styling */
button[type='submit'] {
    display: block;
    width: 80%;
    margin: 30px auto;
    padding: 15px 20px;
    background-color: #346c92;
    color: white;
    font-size: 18px;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

button[type='submit']:hover {
    background-color: #040a6f;
}

button[type='submit']:active {
    transform: scale(0.98);
}

.btn {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.btn-primary {
    background-color: #28a745;
    color: white;
}

.btn-primary:hover {
    background-color: #218838;
}

.btn-secondary {
    background-color: #6c757d;
    color: #fff;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-outline {
    background-color: transparent;
    color: #333;
    border: 1px solid #ccc;
}

.btn-outline:hover {
    transform: scale(1.05);
}

/* =========================================
   5. COLLAPSIBLE SECTIONS
   ========================================= */

.collapsible-section {
    margin-bottom: 20px;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 10px;
    transition: all 0.3s ease;
}

.section-header {
    cursor: pointer;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header::before {
    content: "+";
    font-size: 1.2em;
    font-weight: bold;
}

.section-header:hover {
    background-color: #e8e8f0;
}

.section-fields {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.section-field {
    margin: 15px 0;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

/* Show fields when section is active OR focused */
.collapsible-section.active .section-fields,
.collapsible-section:focus-within .section-fields {
    max-height: 500px;
}

.collapsible-section.active .section-field,
.collapsible-section:focus-within .section-field {
    opacity: 1;
    transform: translateY(0);
}

/* Change plus to minus when active */
.collapsible-section.active .section-header::before {
    content: "−";
    /* Unicode minus sign */
}

/* =========================================
   6. CURRENCY INPUT
   ========================================= */

.currency-group {
    position: relative;
    margin-bottom: 25px;
    width: 100%;
    margin-top: 30px;
    margin-bottom: 30px;
}

.currency-group .input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.currency-group .currency-symbol {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-weight: bold;
    color: #333;
    pointer-events: none;
    font-size: 16px;
    z-index: 2;
    user-select: none;
}

.currency-group input[type="number"] {
    width: 100%;
    padding: 12px 12px 12px 28px;
    color: #000;
    font-size: 16px;
    border: 1px solid #ccc;
    border-radius: 4px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.formatted-amount-container {
    width: 100%;
    text-align: right;
    padding-right: 0;
    margin-top: 5px;
    margin-bottom: 10px;
}

.formatted-amount {
    font-weight: bold;
    color: #5490d1;
    display: inline-block;
    font-size: 14px;
    margin-right: 0;
}

/* =========================================
   7. VALIDATION & ERROR STYLES
   ========================================= */

#validation-errors {
    margin-top: 20px;
    padding: 15px;
    color: #721c24;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 5px;
    display: none;
}

#validation-errors:not(:empty) {
    display: block;
}

/* =========================================
   8. API RESPONSE CONTAINERS
   ========================================= */

#api-response:empty {
    padding: 0;
    border: none;
    margin: 0;
}

.api-response-container {
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    background-color: #ffffff;
    color: #333333;
}

.api-response-container h3 {
    margin-top: 0;
    margin-bottom: 15px;
    font-weight: 500;
    color: #333333;
}

.api-response-container p {
    margin-bottom: 8px;
}

.api-response-container strong {
    font-weight: 600;
}

/* Success styling */
.api-response-container.success {
    border-left: 5px solid #4caf50;
    background-color: #f9fff9;
}

.api-response-container.success .success-header {
    color: #2e7d32;
}

/* Error styling */
.api-response-container.error {
    border-left: 5px solid #f44336;
    background-color: #fff9f9;
}

.api-response-container.error .error-message {
    color: #d32f2f;
}

.api-response-container.error {
    border-left: 5px solid #f44336;
    background-color: #fffafa;
    /* Soft warm white background */
    box-shadow: 0 2px 8px rgba(244, 67, 54, 0.15);
    /* Subtle reddish shadow */
}

.api-response-container.error .error-message {
    color: #d32f2f;
    background-color: rgba(244, 67, 54, 0.05);
    /* Very subtle red tint */
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.api-response-container.error p.error-message {
    border-left: 6px solid #4a90e2;
    margin-right: 10px;
    padding-left: 10px;
    border-radius: 0 4px 4px 0;

}

.api-response-container.error h3 {
    color: #c62828;
    font-weight: 600;
    border-bottom: 1px solid rgba(244, 67, 54, 0.2);
    padding-bottom: 8px;
    margin-bottom: 16px;
}

/* Action buttons */
.api-response-container .action-buttons button {
    margin-top: 15px;
    margin-right: 10px;
}

/* =========================================
   9. LOADING INDICATORS
   ========================================= */

.loading-indicator {
    text-align: center;
    padding: 20px;
}

.spinner {
    margin: 0 auto;
    width: 70px;
    text-align: center;
}

.spinner>div {
    width: 12px;
    height: 12px;
    background-color: #3f607c;
    border-radius: 100%;
    display: inline-block;
    animation: sk-bouncedelay 1.4s infinite ease-in-out both;
}

.spinner .bounce1 {
    animation-delay: -0.32s;
}

.spinner .bounce2 {
    animation-delay: -0.16s;
}

@keyframes sk-bouncedelay {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1.0);
    }
}

/* =========================================
   10. HELPER CLASSES & UTILITIES
   ========================================= */

.payment-purpose-info {
    font-style: italic;
    font-size: 0.9em;
    color: #666;
    margin-top: 5px;
}

.alert {
    padding: 10px;
    border-radius: 4px;
    margin: 15px 0;
    text-align: center;
    font-weight: bold;
}

.alert-error {
    background-color: #ffe6e6;
    color: #d8000c;
    border: 1px solid #d8000c;
}

.alert-success {
    background-color: #e6ffe6;
    color: #009900;
    border: 1px solid #009900;
}

/* =========================================
   11. DARK MODE STYLES
   ========================================= */
/* Dark mode is controlled via body.dark-mode class set by JavaScript (core.js) */
/* This ensures explicit control over theme switching */

body.dark-mode {
    background-color: #0d1b2a;
    background-image: linear-gradient(135deg, #0d1b2a 0%, #1b263b 50%, #243b55 100%);
    color: #f0f0f0;
}

/* Form container and structure */
body.dark-mode .form-container {
    background-color: #1e1e1e;
    box-shadow: 0 0 0 2px #333, 0 8px 20px rgba(0, 0, 0, 0.4), 0 15px 40px rgba(0, 0, 0, 0.5);
}

body.dark-mode .form-container::before {
    background-color: #444;
}

/*images*/
body.dark-mode .light-mode-image {
    display: none;
}

body.dark-mode .dark-mode-image {
    display: block;
}

/* Typography */
body.dark-mode h1,
body.dark-mode label {
    color: #f0f0f0;
}

/* Form elements */
body.dark-mode input[type='text'],
body.dark-mode input[type='number'],
body.dark-mode input[type='email'],
body.dark-mode input[type='tel'],
body.dark-mode input[type='password'],
body.dark-mode select,
body.dark-mode textarea {
    background-color: #2a2a2a;
    border-color: #444;
    color: #f0f0f0;
}

body.dark-mode input:focus,
body.dark-mode select:focus,
body.dark-mode textarea:focus {
    border-color: #0066cc;
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.25);
}

/* Collapsible sections */
body.dark-mode .collapsible-section {
    border-color: #444;
    background-color: #252525;
}

body.dark-mode .section-header {
    background-color: #2a2a2a;
}

body.dark-mode .section-header:hover {
    background-color: #333;
}

/* Buttons */
body.dark-mode button[type='submit'] {
    background-color: #346c92;
}

body.dark-mode button[type='submit']:hover {
    background-color: #0d4ea6;
}

body.dark-mode .action-button.logout-button {
    background-color: #e31818 !important;
}

body.dark-mode .action-button.logout-button:hover {
    background-color: #913737 !important;
}

/* Button styling in dark mode */
body.dark-mode .btn-primary {
    background-color: #2ea043;
}

body.dark-mode .btn-primary:hover {
    background-color: #3cb552;
}

body.dark-mode .btn-secondary {
    background-color: #5a6268;
    color: #fff;
}

body.dark-mode .btn-secondary:hover {
    background-color: #6c757d;
}

body.dark-mode .btn-outline {
    background-color: transparent;
    color: #f0f0f0;
    border-color: #666;
}

/* Validation styles */
body.dark-mode #validation-errors {
    color: #ffb3b9;
    background-color: #4a2228;
    border-color: #631c24;
}

/* API Response Container styles */
body.dark-mode .api-response-container {
    background-color: #2d2d2d !important;
    color: #f0f0f0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

body.dark-mode .api-response-container h3 {
    color: #ffffff;
    font-weight: bold;
}

body.dark-mode .api-response-container p strong {
    color: #a0d2ff;
}

body.dark-mode .api-response-container .transaction-id,
body.dark-mode .api-response-container .error-code,
body.dark-mode .api-response-container .timestamp,
body.dark-mode .api-response-container .status-code,
body.dark-mode .api-response-container .fn-code,
body.dark-mode .api-response-container .acceptance-time,
body.dark-mode .api-response-container .message,
body.dark-mode .api-response-container .reject-reason {
    background-color: #3a3a3a;
    padding: 6px 10px;
    border-radius: 4px;
    color: #ffffff;
    margin: 5px 0;
    border-left: 6px solid #4a90e2;
    margin-right: 20px;
}

body.dark-mode .api-response-container.success {
    border-left: 5px solid #4caf50;
}

body.dark-mode .api-response-container.success .success-header {
    color: #4caf50;
}

body.dark-mode .api-response-container.error {
    border-left: 10px solid #f44336;
    background-color: rgba(244, 67, 54, 0.1) !important;
}

body.dark-mode .api-response-container.error .error-message {
    background-color: rgba(244, 67, 54, 0.1) !important;
    color: #ff8a80;
    border-left-color: #f44336;
    border-left: 6px solid #346c92;
}

body.dark-mode .api-response-container.error p.error-message {
    border-left: 6px solid #346c92;
    margin-right: 10px !important;
    padding-left: 10px;
}

body.dark-mode .api-response-container.error h3 {
    color: #ececec;
    font-weight: 600;
    border-bottom: 1px solid rgba(244, 67, 54, 0.2);
    padding-bottom: 8px;
    margin-bottom: 16px;
}

body.dark-mode .api-response-container .action-buttons button {
    background-color: #333333;
    color: #ffffff;
    border: 1px solid #555555;
}

body.dark-mode .api-response-container .action-buttons button.btn-primary {
    background-color: #346c92;
    border-color: #346c92;
}

body.dark-mode .api-response-container .action-buttons button.btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
}

body.dark-mode .api-response-container .action-buttons button:hover {
    filter: brightness(1.1);
}

/* Loading spinner */
body.dark-mode .spinner>div {
    background-color: #f0f0f0;
}

/* Footer */
body.dark-mode footer,
body.dark-mode .footer {
    color: #999;
    border-top: 1px solid #333;
}

/* Helper classes */
body.dark-mode .checkbox-label {
    color: #ccc;
}

body.dark-mode .payment-purpose-info {
    color: #aaa;
}

body.dark-mode .currency-group input[type="number"] {
    color: #fff;
}

body.dark-mode .currency-group .currency-symbol {
    color: #ddd;
}

/* Ensure links are visible in dark mode */
body.dark-mode a {
    color: #A0C1D6;
}

body.dark-mode a:hover {
    color: #80bdff;
}

body.dark-mode .auth-links a {
    color: #A0C1D6;
}

body.dark-mode .alert-error {
    background-color: #3a0404;
    color: #ff9999;
    border: 1px solid #d8000c;
}

body.dark-mode .alert-success {
    background-color: #003300;
    color: #99ff99;
    border: 1px solid #006600;
}

/* Component header in dark mode */
body.dark-mode #component-header {
    background-color: #1a1a2e;
}

body.dark-mode .header-content {
    background-color: #252525;
}

body.dark-mode .user-dropdown {
    background-color: #333;
}

body.dark-mode .user-dropdown a {
    color: #f0f0f0;
}

body.dark-mode .user-dropdown a:hover {
    background-color: #444;
}

/* =========================================
   12. RESPONSIVE DESIGN
   ========================================= */

/* Medium screens (tablets) */
@media screen and (max-width: 768px) {
    .form-container {
        max-width: 90%;
        margin: 30px auto;
        padding: 15px;
    }

    h1 {
        font-size: 1.5rem;
    }

    .bank-logo-container img {
        max-width: 200px;
    }

    .idebit-logo-centered-container img {
        max-width: 100px;
    }

    .section-header {
        padding: 12px;
    }

    button[type='submit'] {
        width: 90%;
        font-size: 16px;
        padding: 12px 15px;
    }

    .transaction-id {
        font-size: 14px;
        padding: 8px;
    }

    .success-container,
    .error-container {
        padding: 15px;
    }

    .success-header {
        font-size: 20px;
    }
}

/* Small screens (phones) */
@media screen and (max-width: 480px) {
    .form-container {
        max-width: 95%;
        margin: 10px auto;
        border-radius: 20px;
        padding: 15px;
        box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.1);
    }

    .form-container::before {
        width: 60px;
        top: 12px;
    }

    h1 {
        font-size: 1.3rem;
    }

    .bank-logo-container img {
        max-width: 150px;
    }

    .idebit-logo-centered-container img {
        max-width: 80px;
    }

    label {
        font-size: 14px;
    }

    input[type='text'],
    input[type='number'],
    input[type='email'],
    input[type='tel'],
    input[type='password'],
    select,
    textarea {
        font-size: 14px;
        padding: 8px;
    }

    .form-group {
        margin-bottom: 12px;
    }

    button[type='submit'] {
        width: 100%;
        padding: 10px;
        margin: 20px auto;
        font-size: 15px;
    }

    .transaction-id {
        font-size: 13px;
        padding: 6px;
    }

    .success-container,
    .error-container {
        padding: 10px;
    }

    .success-header {
        font-size: 18px;
    }

    .btn {
        padding: 6px 12px;
        font-size: 13px;
    }
}

/* Footer positioning for taller screens */
@media screen and (min-height: 768px) {

    footer,
    .footer {
        position: relative;
        margin-top: auto;
    }

    .form-container {
        flex: 1;
    }
}
