/* ==========================================================================
   OPENS CLOUD | ELITE UNIFIED DESIGN SYSTEM (MD3)
   Architecture: Material Design 3 / Google Professional Grade
   ========================================================================== */

   :root {
    /* --- MD3 CORE PALETTE --- */
    --md-primary: #0b57d0;
    --md-primary-hover: #0842a0;
    --md-on-primary: #ffffff;
    --md-primary-container: #d3e3fd;
    --md-on-primary-container: #041e49;
    
    --md-surface: #f3f6fc;
    --md-surface-bright: #ffffff;
    --md-surface-container: #edf2fa;
    --md-surface-container-high: #e1e9f4;
    
    --md-on-surface: #1f1f1f;
    --md-on-surface-variant: #444746;
    --md-outline: #747775;
    --md-outline-variant: #c4c7c5;
    --md-error: #b3261e;
    --md-success: #146c2e;
  
    /* --- BRAND COLORS --- */
    --brand-drive: #1a73e8;
    --brand-photos: #ea4335;
    --brand-storage: #fbbc04;
  
    /* --- GEOMETRY & SHADOWS --- */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 24px;
    --radius-xl: 32px;
    --radius-full: 9999px;
  
    --shadow-1: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.08);
    --shadow-2: 0 4px 12px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
    --shadow-3: 0 12px 32px rgba(4,30,73,0.12), 0 4px 12px rgba(4,30,73,0.04);
  
    /* --- TYPOGRAPHY FLUIDITY --- */
    --font-sans: 'Google Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-body: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    
    --page-max-width: 1440px;
    --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  }
  
  /* --- RESET --- */
  * { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
    -webkit-tap-highlight-color: transparent;
  }
  html { 
    scroll-behavior: smooth; 
    font-size: 16px;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  html::-webkit-scrollbar { display: none; }

  body {
    font-family: var(--font-body);
    background-color: var(--md-surface);
    color: var(--md-on-surface);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    scrollbar-width: none;
    -ms-overflow-style: none;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
  }
  body::-webkit-scrollbar { display: none; }
  
  body.landing-page {
    overflow-y: auto;
    overflow-x: hidden;
  }
  
  /* --- LOAD BALANCER SPLASH --- */
  .lb-splash {
    position: fixed; inset: 0; z-index: 9999;
    background: var(--md-surface-bright);
    display: flex; align-items: center; justify-content: center;
    transition: opacity 0.6s var(--ease-standard);
    overflow: hidden;
    will-change: opacity;
  }
  .lb-splash.fade-out { opacity: 0; pointer-events: none; }
  .lb-content { text-align: center; width: 100%; max-width: 320px; will-change: transform; }
  .lb-logo { width: 64px; height: 64px; margin-bottom: 32px; animation: lb-pulse 2s infinite var(--ease-standard); }
  .lb-loader { 
    height: 4px; width: 100%; background: var(--md-surface-container-high); 
    border-radius: var(--radius-full); overflow: hidden; margin-bottom: 16px;
  }
  .lb-progress-bar { 
    height: 100%; width: 0%; background: var(--md-primary); 
    transition: width 0.3s var(--ease-standard);
    box-shadow: 0 0 10px rgba(11, 87, 208, 0.3);
    will-change: width;
  }
  .lb-text { font-family: var(--font-sans); font-size: 14px; color: var(--md-on-surface-variant); font-weight: 500; }

  @keyframes lb-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.95); opacity: 0.9; }
  }
  
  h1, h2, h3, h4 { font-family: var(--font-sans); }
  a { text-decoration: none; color: inherit; }
  button { cursor: pointer; font-family: var(--font-sans); border: none; background: none; }
  
  /* --- BACKGROUND GLASS ORBS --- */
  .bg-orbs { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
  .orb { position: absolute; border-radius: 50%; filter: blur(100px); opacity: 0.5; animation: float 10s ease-in-out infinite alternate; }
  .orb-primary { top: -10%; left: -5%; width: 40vw; height: 40vw; background: var(--md-primary-container); }
  .orb-secondary { bottom: -10%; right: -5%; width: 50vw; height: 50vw; background: #fce8e6; animation-delay: -5s; }
  .orb-tertiary { top: 40%; left: 40%; width: 30vw; height: 30vw; background: #fff8e1; opacity: 0.3; }
  
  @keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, 30px) scale(1.05); }
  }
  
  /* --- ANIMATIONS --- */
  .animate-slide-up { animation: slideUp 0.8s var(--ease-standard) forwards; opacity: 0; transform: translateY(30px); }
  .delay-1 { animation-delay: 0.15s; }
  
  @keyframes slideUp {
    to { opacity: 1; transform: translateY(0); }
  }
  
  /* --- HEADER --- */
  .app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 16px 24px;
    background: rgba(243, 246, 252, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--md-surface-container-high);
  }
  .header-content {
    max-width: var(--page-max-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
  .brand-link { display: flex; align-items: center; gap: 12px; }
  .brand-logo { width: 36px; height: 36px; }
  .brand-text { font-family: var(--font-sans); font-size: 22px; font-weight: 500; color: var(--md-on-surface); }
  
  /* --- BUTTONS --- */
  .btn {
    display: inline-flex; align-items: center; justify-content: center;
    height: 48px; padding: 0 24px;
    border-radius: var(--radius-full);
    font-size: 15px; font-weight: 500;
    transition: all 0.2s var(--ease-standard);
  }
  .btn-primary { background: var(--md-primary); color: var(--md-on-primary); box-shadow: var(--shadow-1); }
  .btn-primary:hover { background: var(--md-primary-hover); box-shadow: var(--shadow-2); transform: translateY(-1px); }
  .btn-text { color: var(--md-primary); padding: 0 16px; }
  .btn-text:hover { background: var(--md-surface-container); }
  
  /* --- MAIN LAYOUT (LANDING) --- */
  .main-layout { flex: 1; display: flex; align-items: center; padding: 40px 24px; }
  .layout-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 60px;
    align-items: center;
  }
  
  /* --- HERO SECTION --- */
  .hero-section { display: flex; flex-direction: column; gap: 24px; }
  .kicker-badge {
    display: inline-flex; align-items: center; gap: 8px; width: fit-content;
    padding: 8px 16px; border-radius: var(--radius-full);
    background: var(--md-surface-bright); border: 1px solid var(--md-outline-variant);
    font-family: var(--font-sans); font-size: 13px; font-weight: 500; color: var(--md-on-surface-variant);
  }
  .kicker-badge svg { width: 16px; height: 16px; fill: var(--md-primary); }
  
  .hero-title { font-size: clamp(40px, 5vw, 64px); line-height: 1.1; letter-spacing: -0.04em; color: var(--md-on-surface); }
  .hero-subtitle { font-size: clamp(16px, 2vw, 20px); line-height: 1.6; color: var(--md-on-surface-variant); max-width: 540px; }
  
  .feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 16px; }
  .feature-item { display: flex; align-items: flex-start; gap: 16px; }
  .feature-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
  .feature-icon svg { width: 24px; height: 24px; fill: currentColor; }
  .drive-icon { background: #e8f0fe; color: var(--brand-drive); }
  .photos-icon { background: #fce8e6; color: var(--brand-photos); }
  .feature-item h3 { font-size: 16px; font-weight: 500; margin-bottom: 4px; }
  .feature-item p { font-size: 14px; color: var(--md-on-surface-variant); line-height: 1.4; }
  
  /* --- AUTH CARD --- */
  .auth-card {
    background: var(--md-surface-bright);
    border-radius: var(--radius-lg);
    padding: 48px;
    box-shadow: var(--shadow-3);
    border: 1px solid var(--md-outline-variant);
    position: relative;
    overflow: hidden;
    min-height: 480px;
  }
  
  .auth-view {
    display: none;
    flex-direction: column;
    animation: fadeIn 0.4s var(--ease-standard);
  }
  .auth-view.active { display: flex; }
  @keyframes fadeIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
  
  .auth-header { text-align: center; margin-bottom: 32px; }
  .auth-logo { width: 48px; height: 48px; margin-bottom: 16px; }
  .auth-icon-badge { width: 56px; height: 56px; background: var(--md-primary-container); color: var(--md-primary); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 16px; }
  .auth-icon-badge svg { width: 28px; height: 28px; fill: currentColor; }
  .auth-header h2 { font-size: 28px; font-weight: 400; margin-bottom: 8px; letter-spacing: -0.5px; }
  .auth-header p { color: var(--md-on-surface-variant); font-size: 15px; }
  
  .auth-form { display: flex; flex-direction: column; gap: 24px; }
  
  /* MD3 Floating Label Inputs */
  .input-group { position: relative; }
  .md-input {
    width: 100%; height: 56px;
    padding: 16px 16px 0;
    border: 1px solid var(--md-outline);
    border-radius: var(--radius-md);
    background: transparent;
    font-size: 16px; color: var(--md-on-surface);
    transition: border-color 0.2s, box-shadow 0.2s;
  }
  .md-input:focus { border-color: var(--md-primary); box-shadow: inset 0 0 0 1px var(--md-primary); outline: none; }
  .md-label {
    position: absolute; top: 18px; left: 16px;
    font-size: 16px; color: var(--md-on-surface-variant);
    pointer-events: none;
    transition: 0.2s var(--ease-standard);
    background: var(--md-surface-bright); padding: 0 4px; margin-left: -4px;
  }
  .md-input:focus ~ .md-label, .md-input:not(:placeholder-shown) ~ .md-label {
    top: -8px; font-size: 12px; color: var(--md-primary);
  }
  .md-input:not(:focus):not(:placeholder-shown) ~ .md-label { color: var(--md-on-surface-variant); }
  
  .auth-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; }
  .otp-actions { justify-content: flex-end; gap: 8px; }
  .text-link { color: var(--md-primary); font-size: 14px; font-weight: 500; font-family: var(--font-sans); }
  .text-link:hover { text-decoration: underline; }
  
  /* OTP Grid */
  .otp-container { display: flex; justify-content: center; gap: 12px; margin: 16px 0; }
  .otp-cell {
    width: 48px; height: 56px;
    text-align: center; font-size: 24px; font-weight: 500;
    border: 1px solid var(--md-outline); border-radius: var(--radius-md);
    color: var(--md-on-surface); background: transparent;
    transition: all 0.2s;
  }
  .otp-cell:focus { border-color: var(--md-primary); box-shadow: inset 0 0 0 1px var(--md-primary); outline: none; }
  
  /* Status Message */
  .auth-message { margin-top: 24px; text-align: center; font-size: 14px; font-weight: 500; min-height: 20px; }
  .auth-message.error { color: var(--md-error); }
  .auth-message.success { color: var(--md-success); }
  .auth-message.info { color: var(--md-primary); }
  
  /* --- FOOTER --- */
  .app-footer {
    padding: 24px;
    border-top: 1px solid var(--md-surface-container-high);
    color: var(--md-on-surface-variant);
    font-size: 14px;
  }
  .footer-content {
    max-width: var(--page-max-width);
    margin: 0 auto;
    display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 24px;
  }
  .footer-brand .brand-text { font-weight: 500; color: var(--md-on-surface); }
  .footer-links { display: flex; gap: 24px; }
  .footer-links a:hover { color: var(--md-primary); }
  .footer-locale { display: flex; align-items: center; gap: 8px; }
  .icon-sm { width: 18px; height: 18px; fill: currentColor; }
  
  /* --- RESPONSIVE SCALING --- */
  @media (max-width: 1024px) {
    .layout-grid { grid-template-columns: 1fr; gap: 48px; text-align: center; }
    .hero-section { align-items: center; }
    .hero-subtitle { margin: 0 auto; }
    .feature-grid { text-align: left; max-width: 600px; margin: 24px auto 0; }
    .auth-card { max-width: 500px; margin: 0 auto; width: 100%; }
  }
  
  @media (max-width: 600px) {
    .main-layout { padding: 24px 16px; }
    .auth-card { padding: 32px 24px; border-radius: var(--radius-lg); }
    .feature-grid { grid-template-columns: 1fr; gap: 20px; }
    .otp-container { gap: 8px; }
    .otp-cell { width: 40px; height: 50px; font-size: 20px; }
    .footer-content { flex-direction: column; align-items: center; text-align: center; }
    .footer-links { flex-wrap: wrap; justify-content: center; }
  }

  /* --- SELECTION & INTERACTIVE CARDS --- */
  .media-card.selected, tr.selected {
    background: var(--md-primary-container) !important;
    transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .media-card {
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s ease;
  }
  .media-card.selected {
    transform: scale(0.96);
    box-shadow: 0 0 0 2px var(--md-primary);
  }
  .select-check-static svg, .select-check svg {
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  }
  .select-check-static:active svg, .select-check:active svg {
    transform: scale(0.8);
  }
  .selection-toolbar {
    position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(120px);
    background: rgba(11, 87, 208, 0.9); color: white;
    height: 56px; padding: 0 24px; border-radius: 28px;
    display: flex; align-items: center; gap: 24px;
    box-shadow: var(--shadow-3); z-index: 4000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }