/* Base Styles for FairPrice Member Portal */

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

html, body {
    height: 100%;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: #333;
}

body {
    background-color: #f5f7fa;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 0.5rem;
    font-weight: 600;
    line-height: 1.2;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.75rem;
}

h4 {
    font-size: 1.5rem;
}

p {
    margin-bottom: 1rem;
}

a {
    color: #0066cc;
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: #0052a3;
    text-decoration: underline;
}

/* Button Styles */
.btn {
    display: inline-block;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    transition: all 0.2s;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover {
    text-decoration: none;
}

.btn-primary {
    color: #fff;
    background-color: #0066cc;
    border-color: #0066cc;
}

.btn-primary:hover {
    background-color: #0052a3;
    border-color: #0052a3;
}

.btn-secondary {
    color: #333;
    background-color: #f0f0f0;
    border-color: #eee;
}

.btn-secondary:hover {
    background-color: #e5e5e5;
    border-color: #ddd;
}

.btn-text {
    color: #0066cc;
    background: transparent;
    border: none;
}

.btn-text:hover {
    color: #0052a3;
    background-color: rgba(0, 102, 204, 0.05);
}

.btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

/* Form Elements */
label {
    display: inline-block;
    margin-bottom: 0.5rem;
}

input, 
select, 
textarea {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

input:focus, 
select:focus, 
textarea:focus {
    color: #495057;
    background-color: #fff;
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

input:disabled,
select:disabled,
textarea:disabled {
    background-color: #f8f9fa;
    opacity: 1;
}

/* Container Spacing */
.container {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

/* Helper Classes */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: #6c757d;
}

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 3rem; }

.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }
.ml-3 { margin-left: 1rem; }
.ml-4 { margin-left: 1.5rem; }
.ml-5 { margin-left: 3rem; }

.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }
.mr-3 { margin-right: 1rem; }
.mr-4 { margin-right: 1.5rem; }
.mr-5 { margin-right: 3rem; }

/* Responsive Breakpoints */
@media (min-width: 576px) {
    .container {
        max-width: 540px;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }
}

@media (min-width: 992px) {
    .container {
        max-width: 960px;
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

/* Global Styles */
:root {
    --primary-color: #007bff;
    --primary-dark: #0056b3;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --error-color: #dc3545;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --white: #ffffff;
    --border-color: #dee2e6;
    --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --border-radius: 6px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    position: relative;
}

h1, h2, h3, h4, h5, h6 {
    color: #333;
    margin-bottom: 1rem;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

.btn {
    display: inline-block;
    padding: 0.6rem 1.2rem;
    background-color: var(--light-color);
    color: var(--dark-color);
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    text-align: center;
}

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

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

.btn-text {
    background: none;
    color: var(--primary-color);
    padding: 0.2rem 0.5rem;
}

.btn-text:hover {
    color: var(--primary-dark);
    background-color: rgba(0, 123, 255, 0.1);
}

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

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

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

.form-group input:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
}

.form-info {
    font-size: 0.85rem;
    color: var(--secondary-color);
    margin-top: 0.3rem;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.form-row .form-group {
    flex: 1;
}

.form-actions {
    margin-top: 1.5rem;
    display: flex;
    justify-content: flex-end;
}

.section {
    display: none;
    min-height: 100vh;
    animation: fadeIn 0.5s ease;
    opacity: 0;
    position: absolute;
    width: 100%;
    top: 0;
    left: 0;
}

.section.active {
    display: block;
    opacity: 1;
    position: relative;
}

/* Login Section */
#login-section {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: linear-gradient(135deg, #007bff 0%, #004c9e 100%);
}

.login-container {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: 2rem;
    width: 90%;
    max-width: 400px;
    box-shadow: var(--box-shadow);
    text-align: center;
}

.logo-container {
    margin-bottom: 1.5rem;
}

.logo {
    max-width: 200px;
    height: auto;
    object-fit: contain;
}

#login-form {
    text-align: left;
    margin-top: 1.5rem;
}

/* Portal Header */
.portal-header {
    background-color: var(--white);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--box-shadow);
    position: relative;
}

.logo-sm {
    width: 120px;
}

.logo-sm img {
    max-width: 100%;
    height: auto;
    object-fit: contain;
}

.user-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 1.5rem;
}

.nav-link {
    color: var(--secondary-color);
    font-weight: 500;
    padding: 0.5rem;
    position: relative;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-link.active {
    color: var(--primary-color);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 3px 3px 0 0;
}

/* Portal Content */
.portal-content {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.portal-content.centered {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 80px);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Dashboard Cards */
.dashboard-card {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--box-shadow);
}

/* Buy Shares Tab */
.purchase-options {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
}

.option-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.option-tab {
    border: none;
    background: none;
    padding: 0.7rem 1.5rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--secondary-color);
    position: relative;
}

.option-tab.active {
    color: var(--primary-color);
}

.option-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 3px 3px 0 0;
}

.purchase-form {
    display: none;
}

.purchase-form.active {
    display: block;
}

.nominee-fields {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 80px auto;
    gap: 0.7rem;
    margin-bottom: 1rem;
    align-items: center;
}

.nominee-actions {
    margin-top: 0.5rem;
}

.remove-nominee {
    color: var(--error-color);
    cursor: pointer;
}

.payment-options {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.payment-option {
    display: flex;
    align-items: center;
    padding: 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
}

.payment-option:hover {
    border-color: var(--primary-color);
}

.payment-option input {
    margin-right: 0.5rem;
}

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

.total-row {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
}

.total-row.total {
    font-weight: bold;
    border-top: 1px dashed var(--border-color);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
}

.points-info {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.points-row {
    display: flex;
    justify-content: space-between;
    padding: 0.3rem 0;
}

/* OTP Section */
.otp-fields {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin: 2rem 0;
}

.otp-field {
    width: 3rem;
    height: 3rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1.5rem;
    text-align: center;
}

.resend-text {
    margin-top: 1rem;
    font-size: 0.9rem;
}

/* Profile Tab */
.profile-details {
    background-color: var(--white);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
}

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

.profile-section:last-child {
    border-bottom: none;
}

.profile-section h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.profile-group {
    display: flex;
    border-bottom: 1px dashed var(--border-color);
    padding: 0.7rem 0;
}

.profile-group:last-child {
    border-bottom: none;
}

.profile-label {
    width: 150px;
    font-weight: 500;
    color: var(--secondary-color);
}

.profile-value {
    flex: 1;
}

/* Confirmation Section */
.confirmation-message {
    padding: 2rem;
    background-color: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    max-width: 600px;
    text-align: center;
}

.success-icon {
    font-size: 4rem;
    color: var(--success-color);
    margin-bottom: 1rem;
}

.message {
    padding: 1rem;
    margin: 1rem 0;
    border-radius: var(--border-radius);
    font-weight: 500;
}

.message.error {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--error-color);
    border-left: 4px solid var(--error-color);
}

.message.success {
    background-color: rgba(40, 167, 69, 0.1);
    color: var(--success-color);
    border-left: 4px solid var(--success-color);
}

.message.info {
    background-color: rgba(0, 123, 255, 0.1);
    color: var(--primary-color);
    border-left: 4px solid var(--primary-color);
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Responsive Styles */
@media (max-width: 768px) {
    .portal-header {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }
    
    .main-nav ul {
        gap: 1rem;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .nominee-fields,
    .payment-options {
        grid-template-columns: 1fr;
    }
    
    .portal-content {
        padding: 1rem;
    }
    
    .otp-fields {
        gap: 0.3rem;
    }
    
    .otp-field {
        width: 2.5rem;
        height: 2.5rem;
    }
}

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

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

.form-section h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.form-group-full {
    flex: 1 0 100%;
}

/* Update form rows to handle more elements */
.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

/* Make sure the welcome form is scrollable if it gets too long */
#welcome-section .portal-content {
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .form-group,
    .form-group-full {
        width: 100%;
    }
}

/* Add styles for the info-item class for dashboard */
.info-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px dashed var(--border-color);
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 500;
    color: var(--secondary-color);
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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