/* Main stylesheet for SocialLoan app */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --primary-color: #ff385c;
  --secondary-color: #6979f8;
  --text-color: #222222;
  --text-secondary: #717171;
  --background-color: #f5f5f7;
  --white: #ffffff;
  --light-gray: #eeeeef;
  --border-color: #e0e0e0;
  --success-color: #34c759;
  --warning-color: #ffcc00;
  --error-color: #ff3b30;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-color);
  background-color: var(--background-color);
  line-height: 1.5;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Device Frame Styling */
.device-frame {
  width: 375px;
  height: 812px;
  background-color: var(--white);
  border-radius: 44px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  margin: 30px;
  border: 12px solid #111;
}

/* iOS Status Bar */
.status-bar {
  height: 44px;
  width: 100%;
  background-color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.status-bar-left {
  display: flex;
  align-items: center;
}

.status-bar-time {
  font-weight: 600;
  font-size: 14px;
}

.status-bar-right {
  display: flex;
  align-items: center;
}

.signal-icon, .wifi-icon, .battery-icon {
  margin-left: 6px;
}

/* App Content Area */
.app-content {
  height: calc(812px - 44px - 84px);
  overflow-y: auto;
  position: relative;
  background-color: var(--white);
}

/* Bottom Tab Bar */
.tab-bar {
  height: 84px;
  width: 100%;
  background-color: var(--white);
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  align-items: center;
  position: absolute;
  bottom: 0;
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 20%;
}

.tab-icon {
  font-size: 22px;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.tab-label {
  font-size: 10px;
  color: var(--text-secondary);
}

.tab-item.active .tab-icon,
.tab-item.active .tab-label {
  color: var(--primary-color);
}

/* Create Button Special Styling */
.tab-item.create .tab-icon {
  height: 48px;
  width: 48px;
  background-color: var(--primary-color);
  color: var(--white);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
  margin-top: -16px;
}

/* Common Elements */
.header {
  padding: 16px;
  font-weight: 700;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card {
  background-color: var(--white);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

/* Button Styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

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

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

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
}

.btn-sm {
  height: 36px;
  font-size: 14px;
  padding: 0 12px;
}

/* Avatar */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.avatar-sm {
  width: 32px;
  height: 32px;
}

.avatar-lg {
  width: 56px;
  height: 56px;
}

/* Text Styles */
.text-primary {
  color: var(--primary-color);
}

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

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

.text-sm {
  font-size: 13px;
}

.text-lg {
  font-size: 18px;
}

.text-bold {
  font-weight: 600;
}

/* Social Feed Styles */
.feed-item {
  border-bottom: 1px solid var(--border-color);
  padding: 16px;
}

.feed-header {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}

.feed-user-info {
  margin-left: 10px;
  flex: 1;
}

.feed-username {
  font-weight: 600;
  font-size: 15px;
}

.feed-time {
  font-size: 13px;
  color: var(--text-secondary);
}

.feed-content {
  margin-bottom: 12px;
}

.feed-image {
  width: 100%;
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.feed-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.action-buttons {
  display: flex;
  gap: 16px;
}

.action-button {
  display: flex;
  align-items: center;
  color: var(--text-secondary);
}

.action-count {
  margin-left: 4px;
  font-size: 14px;
}

/* Financial Elements */
.finance-card {
  background: linear-gradient(135deg, var(--primary-color) 0%, #ff7b96 100%);
  border-radius: var(--radius-lg);
  padding: 20px;
  color: var(--white);
  margin-bottom: 16px;
}

.finance-balance {
  font-size: 28px;
  font-weight: 700;
  margin: 8px 0;
}

.credit-score {
  display: flex;
  align-items: center;
  margin: 12px 0;
}

.score-label {
  font-size: 14px;
  margin-right: 8px;
}

.score-value {
  font-weight: 700;
  font-size: 16px;
  background-color: rgba(255, 255, 255, 0.2);
  padding: 4px 10px;
  border-radius: 12px;
}

/* Transaction List */
.transaction-list {
  background-color: var(--white);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.transaction-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-color);
}

.transaction-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background-color: var(--light-gray);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
}

.transaction-details {
  flex: 1;
}

.transaction-title {
  font-weight: 600;
}

.transaction-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
}

.transaction-amount {
  font-weight: 600;
}

.amount-positive {
  color: var(--success-color);
}

.amount-negative {
  color: var(--error-color);
}

/* Profile Page */
.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px;
  background-color: var(--white);
}

.profile-stats {
  display: flex;
  width: 100%;
  justify-content: space-around;
  margin: 20px 0;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-value {
  font-weight: 700;
  font-size: 18px;
}

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

.profile-bio {
  text-align: center;
  margin: 8px 0 16px;
  padding: 0 20px;
}

.profile-actions {
  display: flex;
  gap: 8px;
}

/* Grid Layout */
.grid-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  margin-top: 12px;
}

.grid-item {
  aspect-ratio: 1/1;
  overflow: hidden;
}

.grid-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Index Page Display */
.prototype-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  background-color: #f8f9fa;
  min-height: 100vh;
}

.prototype-header {
  text-align: center;
  margin-bottom: 40px;
  max-width: 800px;
}

.prototype-header h1 {
  font-size: 36px;
  margin-bottom: 16px;
  color: var(--primary-color);
}

.prototype-header p {
  font-size: 18px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.prototype-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(375px, 1fr));
  gap: 40px;
  width: 100%;
  max-width: 1600px;
}

.prototype-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.prototype-label {
  text-align: center;
  margin-bottom: 16px;
  font-weight: 600;
  font-size: 18px;
  color: var(--text-color);
  padding: 8px 16px;
  border-radius: 20px;
  background-color: var(--white);
  box-shadow: var(--shadow-sm);
}

.iframe-container {
  border: none;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  border-radius: 40px;
  overflow: hidden;
  width: 375px;
  height: 812px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.iframe-container:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

/* Settings Page Styles */
.settings-container {
  padding: 16px;
}

.settings-section {
  margin-bottom: 24px;
  background-color: var(--white);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.settings-section-title {
  font-size: 15px;
  color: var(--text-secondary);
  font-weight: 600;
  padding: 16px 16px 8px;
}

.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
}

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

.settings-item-label {
  display: flex;
  align-items: center;
}

.settings-icon {
  color: var(--primary-color);
  font-size: 18px;
  margin-right: 12px;
  width: 22px;
  text-align: center;
}

.settings-arrow {
  color: var(--text-secondary);
  font-size: 12px;
}

.settings-value {
  color: var(--text-secondary);
  font-size: 14px;
}

.btn-logout {
  display: block;
  width: 100%;
  padding: 16px;
  text-align: center;
  background-color: #f8f8f8;
  color: #e74c3c;
  border: none;
  font-weight: 600;
  font-size: 16px;
  border-radius: var(--radius-md);
  cursor: pointer;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 34px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--primary-color);
}

input:checked + .toggle-slider:before {
  transform: translateX(22px);
}

/* Messages Page Styles */
.search-container {
  padding: 8px 16px 16px;
}

.search-bar {
  display: flex;
  align-items: center;
  background-color: var(--light-gray);
  border-radius: 20px;
  padding: 8px 12px;
}

.search-icon {
  margin-right: 8px;
  color: var(--text-secondary);
}

.search-bar input {
  background: transparent;
  border: none;
  flex: 1;
  font-size: 14px;
  color: var(--text-color);
  outline: none;
}

.messages-container {
  background-color: var(--white);
}

.message-item {
  display: flex;
  padding: 16px;
  border-bottom: 1px solid var(--border-color);
  text-decoration: none;
  color: inherit;
}

.message-item.unread {
  background-color: rgba(255, 56, 92, 0.05);
}

.message-content {
  flex: 1;
  margin-left: 12px;
}

.message-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
}

.message-name {
  font-weight: 600;
}

.message-time {
  color: var(--text-secondary);
  font-size: 12px;
}

.message-preview {
  display: flex;
  align-items: center;
  color: var(--text-secondary);
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.message-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.loan-badge, .payment-badge, .group-badge, .investment-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 10px;
  margin-right: 6px;
  white-space: nowrap;
}

.loan-badge {
  background-color: rgba(255, 56, 92, 0.1);
  color: var(--primary-color);
}

.payment-badge {
  background-color: rgba(52, 199, 89, 0.1);
  color: var(--success-color);
}

.group-badge {
  background-color: rgba(105, 121, 248, 0.1);
  color: var(--secondary-color);
}

.investment-badge {
  background-color: rgba(255, 204, 0, 0.1);
  color: var(--warning-color);
}

.group-avatar {
  background-color: var(--secondary-color);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

/* Chat Detail Page Styles */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: var(--white);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 10;
}

.chat-header-left {
  display: flex;
  align-items: center;
}

.chat-header-info {
  margin-left: 8px;
}

.chat-user-name {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.chat-status {
  font-size: 12px;
  color: var(--success-color);
}

.chat-header-right {
  display: flex;
  gap: 16px;
  color: var(--primary-color);
}

.chat-container {
  padding: 16px;
  display: flex;
  flex-direction: column;
  height: calc(100% - 60px - 60px);
  overflow-y: auto;
  background-color: #f8f9fa;
}

.date-divider {
  text-align: center;
  margin: 16px 0;
  position: relative;
}

.date-divider span {
  background-color: rgba(0, 0, 0, 0.05);
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

.message-bubble {
  max-width: 75%;
  margin-bottom: 16px;
  position: relative;
  clear: both;
}

.message-bubble.sent {
  float: right;
  margin-left: auto;
}

.message-bubble.received {
  float: left;
  margin-right: auto;
}

.message-text {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.4;
}

.message-bubble.sent .message-text {
  background-color: var(--primary-color);
  color: white;
  border-top-right-radius: 4px;
}

.message-bubble.received .message-text {
  background-color: white;
  color: var(--text-color);
  border-top-left-radius: 4px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message-time {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: 4px;
  text-align: right;
  padding: 0 4px;
}

.message-loan-request {
  background-color: white;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid var(--border-color);
}

.loan-request-header {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.loan-icon {
  width: 32px;
  height: 32px;
  background-color: rgba(255, 56, 92, 0.1);
  color: var(--primary-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
  font-size: 16px;
}

.loan-request-header h3 {
  margin: 0;
  color: var(--text-color);
  font-size: 16px;
  font-weight: 600;
}

.loan-request-details {
  margin-bottom: 16px;
}

.loan-detail {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.detail-label {
  color: var(--text-secondary);
  font-size: 13px;
}

.detail-value {
  font-weight: 600;
  font-size: 13px;
}

.loan-request-actions {
  display: flex;
  gap: 8px;
}

.typing-indicator {
  display: flex;
  align-items: center;
  height: 30px;
  margin-bottom: 16px;
  padding-left: 12px;
  clear: both;
  float: left;
}

.typing-indicator span {
  height: 8px;
  width: 8px;
  margin: 0 2px;
  background-color: var(--text-secondary);
  border-radius: 50%;
  display: block;
  opacity: 0.4;
  animation: typing 1s infinite;
}

.typing-indicator span:nth-child(1) {
  animation-delay: 0s;
}

.typing-indicator span:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing {
  0% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.2); }
  100% { opacity: 0.4; transform: scale(1); }
}

.chat-input-container {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  background-color: var(--white);
  border-top: 1px solid var(--border-color);
  position: absolute;
  bottom: 84px;
  left: 0;
  right: 0;
}

.chat-input-actions {
  display: flex;
  gap: 16px;
  color: var(--text-secondary);
  margin-right: 12px;
}

.chat-input-field {
  flex: 1;
  background-color: var(--light-gray);
  border-radius: 20px;
  padding: 0 16px;
}

.chat-input-field input {
  width: 100%;
  height: 40px;
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
}

.chat-send-button {
  width: 40px;
  height: 40px;
  background-color: var(--primary-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  margin-left: 12px;
}

/* Responsive adjustments */
@media screen and (max-width: 480px) {
  .device-frame {
    width: 100%;
    height: 100vh;
    border-radius: 0;
    margin: 0;
    border: none;
  }
  
  .app-content {
    height: calc(100vh - 44px - 84px);
  }
}