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

html {
    background: rgb(126,115,201);
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    /* min-height: 100vh; */
}

/* Navigation */
.navbar {
    background: transparent;
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.nav-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;   /* stack title and logout vertically */
    align-items: center;      /* center them horizontally */
    text-align: center;       /* center text inside */
    gap: 0.75rem;
}

.nav-title {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 700;
    color: white;
    margin: 0.5rem auto;
    display: block;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.nav-title-link {
    text-decoration: none;
    transition: transform 0.2s;
}

.nav-title-link:hover {
    transform: scale(1.05);
}

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

.user-greeting {
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.title-wrapper {
  display: flex;
  flex-direction: row;      /* keep emojis side by side with title */
  justify-content: center;  /* center the whole group */
  align-items: center;      /* vertically align within the line */
  text-align: center;
  gap: 0.5rem;                /* spacing between emoji and title */
  margin: 0.5rem 0;
  flex-wrap: nowrap;        /* prevent emojis from dropping below */
}

.glorius {
    font-weight: 300;
    font-size: 1.33rem;
    display: block;
}
.main-name {
    font-size: 1.95rem;
    display: block;
}
.nav-title {
  font-size: 2.2rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.3;
  margin: 0;
}

.moneybag {
  font-size: 2rem;
  display: inline-block;
}

.nav-links {
    display: flex;
    gap: 0.5rem;
}

.nav-link {
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: white;
    border-radius: 0.5rem;
    transition: all 0.2s;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.2);
}

.nav-link.logout {
    background: rgba(107, 114, 128, 0.8);
    color: white;
}

.nav-link.logout:hover {
    background: rgba(75, 85, 99, 0.9);
}

/* Main Content */
.main-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: calc(100vh - 120px);
}

/* Flash Messages */
.flash-messages {
    margin-bottom: 2rem;
}

.flash-message {
    background: rgba(34, 197, 94, 0.9);
    color: white;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

/* Cards */
.card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.card h3 {
    color: #4c51bf;
    margin-bottom: 1rem;
    font-size: 1.25rem;
    font-weight: 600;
}

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

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 100%;
    max-width: 400px;
}

.login-card h2 {
    text-align: center;
    color: #4c51bf;
    margin-bottom: 0.5rem;
    font-size: 1.75rem;
}

.login-subtitle {
    text-align: center;
    color: #6b7280;
    margin-bottom: 2rem;
}

.login-help {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
    font-size: 0.875rem;
    color: #6b7280;
}

.login-help ul {
    list-style: none;
    margin: 0.5rem 0;
}

.login-help li {
    padding: 0.25rem 0;
}

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

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

.form-input, .form-input select, .form-input textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: border-color 0.2s;
    background: white;
}

.form-input:focus {
    outline: none;
    border-color: #4c51bf;
    box-shadow: 0 0 0 3px rgba(76, 81, 191, 0.1);
}

.form-help {
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
    text-align: center;
}

.btn-primary {
    background: #4c51bf;
    color: white;
}

.btn-primary:hover {
    background: #4338ca;
    transform: translateY(-1px);
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
}

.btn-warning {
    background: #f59e0b;
    color: white;
}

.btn-warning:hover {
    background: #d97706;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Dashboard */
.dashboard-header {
    text-align: center;
    margin-bottom: 2rem;
}

.dashboard-header h2 {
    color: white;
    font-size: 2rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dashboard-header p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
}

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

/* Balance Display */
.balance-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.balance-card {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 0.75rem;
    text-align: center;
}

.balance-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.balance-amount {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.balance-info {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-bottom: 1rem;
}

.balance-card .btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.balance-card .btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Child Dashboard */
.child-dashboard {
    text-align: center;
    margin-bottom: 2rem;
}

.balance-display {
    background: linear-gradient(135deg, #4c51bf 0%, #4338ca 100%);
    color: white;
    padding: 2rem;
    border-radius: 1rem;
    margin-bottom: 2rem;
    text-align: center;
}

.balance-label {
    font-size: 1.1rem;
    opacity: 0.9;
    margin-bottom: 0.5rem;
}

.balance-amount-large {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

/* Transactions */
.transactions-list {
    max-height: 400px;
    overflow-y: auto;
}

.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
    transition: background-color 0.2s;
}

.transaction-item:hover {
    background: rgba(76, 81, 191, 0.05);
}

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

.transaction-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.transaction-type {
    font-weight: 600;
    color: #374151;
}

.transaction-child {
    font-weight: 500;
    color: #4c51bf;
}

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

.transaction-by {
    color: #9ca3af;
    font-size: 0.75rem;
    font-style: italic;
}

.transaction-date {
    color: #9ca3af;
    font-size: 0.75rem;
}

.transaction-amount {
    font-weight: 700;
    font-size: 1.1rem;
}

.transaction-amount.positive {
    color: #10b981;
}

.transaction-amount.negative {
    color: #ef4444;
}

/* Detailed transactions */
.transactions-list.detailed .transaction-item {
    flex-direction: column;
    align-items: flex-start;
}

.transaction-header {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 0.5rem;
}

.transaction-details {
    width: 100%;
}

.transaction-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.25rem;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h2 {
    color: white;
    font-size: 1.75rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Admin */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.settings-display, .children-settings {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-item, .child-setting {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e5e7eb;
}

.setting-label, .child-name {
    font-weight: 600;
    color: #374151;
}

.setting-value, .child-allowance, .child-balance {
    color: #4c51bf;
    font-weight: 500;
}

.security-notes {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: 0.5rem;
    padding: 1rem;
}

.security-notes ul {
    margin-left: 1.5rem;
    margin-top: 0.5rem;
}

.security-notes li {
    margin: 0.25rem 0;
}

/* No transactions */
.no-transactions {
    text-align: center;
    padding: 2rem;
    color: #6b7280;
}

/* Footer */
.footer {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    text-align: center;
    padding: 1rem;
    color: rgba(255, 255, 255, 0.8);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 900px;
    margin: 0 auto;
}

.footer-message {
    font-size: 1rem;
    font-weight: 500;
}

.footer-deposit {
    font-size: 0.875rem;
    opacity: 0.8;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-user {
        flex-direction: column;
        text-align: center;
    }
    
    .dashboard-grid, .admin-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .transaction-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .balance-amount-large {
        font-size: 2.5rem;
    }
    
    .transaction-header {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .transaction-meta {
        flex-direction: column;
        gap: 0.25rem;
    }
}

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

.card, .login-card {
    animation: slideIn 0.3s ease-out;
}

/* Touch-friendly sizing for mobile */
@media (max-width: 768px) {
    .btn {
        padding: 1rem 1.5rem;
        font-size: 1.1rem;
    }
    
    .form-input {
        padding: 1rem;
        font-size: 1.1rem;
    }
}

/* Dark mode support for better visibility */
@media (prefers-color-scheme: dark) {
    .card, .login-card {
        background: rgba(17, 24, 39, 0.95);
        color: #f9fafb;
    }
    
    .form-input {
        background: rgba(31, 41, 55, 0.8);
        border-color: #4b5563;
        color: #f9fafb;
    }
    
    .transaction-type {
        color: #f9fafb;
    }
}

/* --- Raining money background --- */
.raining-money {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

/* individual emoji "drops" */
.raining-money span {
  position: absolute;
  top: -10%;
  font-size: 2rem;
  animation: fall linear infinite;
  opacity: 0.9;
  text-shadow: 0 0 7px gold;
}

@keyframes fall {
  0% {
    transform: translateY(-10vh) translateX(0) rotate(0deg);
    opacity: 0.8;
  }
  50% {
    transform: translateY(50vh) translateX(20px) rotate(180deg);
  }
  100% {
    transform: translateY(110vh) translateX(-20px) rotate(360deg);
    opacity: 0.4;
  }
}

.raining-money span:nth-child(1)  { left: 5%;  animation-duration: 8s;  animation-delay: 0s; }
.raining-money span:nth-child(2)  { left: 15%; animation-duration: 10s; animation-delay: 2s; }
.raining-money span:nth-child(3)  { left: 25%; animation-duration: 12s; animation-delay: 4s; }
.raining-money span:nth-child(4)  { left: 35%; animation-duration: 9s;  animation-delay: 1s; }
.raining-money span:nth-child(5)  { left: 45%; animation-duration: 11s; animation-delay: 3s; }
.raining-money span:nth-child(6)  { left: 55%; animation-duration: 7s;  animation-delay: 1.5s; }
.raining-money span:nth-child(7)  { left: 65%; animation-duration: 10s; animation-delay: 2.5s; }
.raining-money span:nth-child(8)  { left: 75%; animation-duration: 8s;  animation-delay: 0.5s; }
.raining-money span:nth-child(9)  { left: 85%; animation-duration: 12s; animation-delay: 3.5s; }
.raining-money span:nth-child(10) { left: 95%; animation-duration: 9s;  animation-delay: 1s; }
