/* --- General Body and Page Styles --- */
:root {
    --dark-bg: #1A1A1A;
    --panel-bg: #2C2C2C;
    --accent-green: #34D399;
    --accent-red: #E55B5B;
    --accent-red-dark: #B94848;
    --text-light: #F0F0F0;
    --text-dark: #1A1A1A;
    --accent-purple: #F5128B;
}

body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    background-color: var(--dark-bg);
    color: var(--text-light);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
}

.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--dark-bg), var(--panel-bg));
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

/* #splash-screen .card .loader{
 width:207px;
 transform:translatex(18px) translatey(0px);
} */

.splash-screen.hidden {
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.3s ease-out, transform 0.3s ease-out; /* Reduced from 0.5s */
}


.splash-content {
    text-align: center;
    max-width: max-content;
    padding: 20px;
}

.splash-logo {
    width: 250px;
    height: auto;
    animation: pulse 2s ease-in-out infinite;
}

/* .splash-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent-green);
    margin-bottom: 15px;
} */

.splash-message {
    display: none;
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent-green);
    margin-bottom: 15px;
}

/* --- REMOVED OLD LOADER STYLES --- */

.splash-progress {
    font-size: 0.9rem;
    color: #888;
    font-weight: 600;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* --- ADDED NEW LOADER STYLES --- */
.card {
  background-color: var(--bg-color);
  padding: 0rem 2rem;
  border-radius: 1.25rem;
  /* margin-bottom: 20px; */
}
.loader {
  color: rgb(124, 124, 124);
  font-family: "Poppins", sans-serif;
  font-weight: 500;
  font-size: 25px;
  -webkit-box-sizing: content-box;
  box-sizing: content-box;
  height: 40px;
  padding: 10px 10px;
  display: -webkit-box;
  display: -ms-flexbox;
  display: flex;
  border-radius: 8px;
  justify-content: center
}

.card .loader p{
 position:relative;
 top:-25px;
}

/* #splash-screen .card .loader{
 width:205px;
 transform:translatex(15px) translatey(0px);
} */

.words {
  overflow: hidden;
  position: relative;
  text-align: start;
}
.words::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    var(--bg-color) 10%,
    transparent 30%,
    transparent 70%,
    var(--bg-color) 90%
  );
  z-index: 20;
}

.word {
  display: block;
  height: 100%;
  padding-left: 6px;
  color: var(--accent-purple); /* Use existing purple for consistency */
  animation: spin_4991 4s infinite;
}

@keyframes spin_4991 {
  10% {
    -webkit-transform: translateY(-102%);
    transform: translateY(-102%);
  }

  25% {
    -webkit-transform: translateY(-100%);
    transform: translateY(-100%);
  }

  35% {
    -webkit-transform: translateY(-202%);
    transform: translateY(-202%);
  }

  50% {
    -webkit-transform: translateY(-200%);
    transform: translateY(-200%);
  }

  60% {
    -webkit-transform: translateY(-302%);
    transform: translateY(-302%);
  }

  75% {
    -webkit-transform: translateY(-300%);
    transform: translateY(-300%);
  }

  85% {
    -webkit-transform: translateY(-402%);
    transform: translateY(-402%);
  }

  100% {
    -webkit-transform: translateY(-400%);
    transform: translateY(-400%);
  }
}
/* --- END OF NEW LOADER STYLES --- */


/* --- IMPROVED AUTHENTICATION STYLES --- */
.auth-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    box-sizing: border-box;
}

.auth-content {
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.auth-hint {
    background-color: var(--panel-bg);
    padding: 15px 20px;
    border-radius: 10px;
    margin-top: 20px;
    font-size: 0.9rem;
    color: #ccc;
    border-left: 4px solid var(--accent-green);
}

/* --- CARD HINT STYLES (positioned below card) --- */
.card-hint {
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.8);
    color: var(--text-light);
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.85rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards;
    animation-delay: 1s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}
.card-container.is-revealed + .card-hint {
    display: none;
}

.face-detection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1001; /* Higher than auth-container */
    padding: 20px;
    box-sizing: border-box;
}

.face-detection-overlay.active {
    display: flex;
}

.face-detection-content {
    text-align: center;
    max-width: 400px;
    width: 100%;
}

.face-detection-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--accent-green);
    margin-bottom: 20px;
}

.face-detection-message {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 30px;
    line-height: 1.5;
}

/* Failure state - keep same background, change message color */
.face-detection-overlay.failure .face-detection-message {
    color: #fca5a5; /* Light red text */
}

.face-detection-overlay.failure .face-detection-title {
    color: #ef4444; /* Red title */
}

.face-scan-animation {
    width: 120px;
    height: 120px;
    margin: 0 auto 30px;
    position: relative;
    border: 3px solid rgba(52, 211, 153, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.face-scan-animation::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border: 3px solid transparent;
    border-top-color: var(--accent-green);
    border-radius: 50%;
    animation: face-scan-rotate 2s linear infinite;
}

.face-scan-animation::after {
    content: '👤';
    font-size: 3rem;
    color: var(--accent-green);
    animation: face-scan-pulse 1.5s ease-in-out infinite;
}

/* Failure Animation - Red border and X icon */
.face-detection-overlay.failure .face-scan-animation {
    border-color: rgba(239, 68, 68, 0.3);
}

.face-detection-overlay.failure .face-scan-animation::before {
    border-top-color: #ef4444;
    animation: none;
    border-top-color: #ef4444;
    border-right-color: #ef4444;
    border-bottom-color: #ef4444;
    border-left-color: #ef4444;
    background-color: rgba(239, 68, 68, 0.1);
}

.face-detection-overlay.failure .face-scan-animation::after {
    content: '✗';
    color: #ef4444;
    font-size: 4rem;
    font-weight: bold;
    animation: face-failure-shake 0.5s ease-in-out;
}

.face-detection-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.face-detection-dot {
    width: 10px;
    height: 10px;
    background-color: var(--accent-green);
    border-radius: 50%;
    animation: face-detection-bounce 1.5s ease-in-out infinite;
}

.face-detection-dot:nth-child(2) { 
    animation-delay: 0.2s; 
}

.face-detection-dot:nth-child(3) { 
    animation-delay: 0.4s; 
}

/* Failure state dots - red color and stop animation */
.face-detection-overlay.failure .face-detection-dot {
    background-color: #ef4444;
    animation: none;
}

.face-detection-status {
    font-size: 0.9rem;
    color: #888;
    font-weight: 600;
}

/* Failure status text */
.face-detection-overlay.failure .face-detection-status {
    color: #fca5a5;
}

@keyframes face-scan-rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes face-scan-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

@keyframes face-detection-bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* Success Animation */
.face-detection-overlay.success .face-scan-animation::before {
    border-top-color: var(--accent-green);
    animation: none;
}

.face-detection-overlay.success .face-scan-animation::after {
    content: '✓';
    color: var(--accent-green);
    animation: face-success-scale 0.5s ease-out;
}

@keyframes face-success-scale {
    0% { transform: scale(0.5); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Failure Animation */
@keyframes face-failure-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-5px); }
    80% { transform: translateX(5px); }
}

/* --- CORRECTED LAYOUT --- */
.site-grid {
    display: grid;
    /* Defines 3 columns: left space, auto-sized content, right space */
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    justify-content: center;
    width: 100%;
    /* Prevents the layout from getting too wide on large screens */
    max-width: 1200px; 
    gap: 40px; /* This creates the space between icons and card */
}

.wrapper {
    grid-column: 1; /* Assigns icons to the first column */
    justify-self: end; /* Aligns icons to the right edge of their column */
}

.page-container {
    grid-column: 2; /* Assigns main content to the center column */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    width: 100%;
    max-width: 375px;
}

/* --- 3D Card Flip and Reveal Styles --- */
.card-flipper {
    width: 100%;
    perspective: 1500px;
}

.card-container {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4.5;
    transition: transform 0.8s;
    transform-style: preserve-3d;
    cursor: pointer;
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* --- Card Front Specific Styles --- */
.card-front {
    background-color: #333;
}

.card-image-background {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.7s ease-in-out;
    filter: blur(15px) brightness(0.7);
    transform: scale(1.1);
}

.card-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.4);
}

.pre-reveal-content, .post-reveal-content {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease;
    padding: 20px;
    box-sizing: border-box;
}


.pre-reveal-text {
    text-align: center;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.pre-reveal-text h1, .pre-reveal-text p {
    margin: 0;
    font-weight: 800;
    line-height: 1.2;
    font-size: 2.2rem;
}
.pre-reveal-text span {
    color: var(--accent-green);
}

/* Style for the logo */
.logo {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 120px;
    height: auto;
}


.post-reveal-content {
    opacity: 0;
    align-items: flex-end;
}


/* --- Card Back Styles --- */
.card-back {
    background-color: var(--dark-bg);
    transform: rotateY(180deg);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 30px;
    box-sizing: border-box;
    position: relative;
}

.message-content {
    width: 100%;
    text-align: center;
}

.message-section {
    margin-bottom: 25px;
}
.message-section h2 {
    margin: 0 0 5px 0;
    font-size: 1rem;
    font-weight: 600;
    color: #999;
}
.message-section p {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-light);
    line-height: 1.5;
}
.message-section.message-body p {
    font-size: 1rem;
    font-weight: 600;
}

.flip-indicator {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    
    background-color: rgba(0, 0, 0, 0.6);
    color: var(--text-light);
    padding: 8px 18px;
    border-radius: 30px;
    font-size: 0.9rem;
    font-weight: 600;
    backdrop-filter: blur(5px);
}

/* --- State Change CSS --- */
.card-container.is-revealed .card-image-background {
    filter: blur(0) brightness(1);
    transform: scale(1);
}
.card-container.is-revealed .pre-reveal-content {
    opacity: 0;
    pointer-events: none;
}
.card-container.is-revealed .post-reveal-content {
    opacity: 1;
}
.card-container.is-flipped {
    transform: rotateY(180deg);
}

.no-card-container {
    display: none; /* Hidden by default */
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 40px;
    background-color: var(--panel-bg);
    border-radius: 20px;
    width: 100%;
    box-sizing: border-box;
}

.no-card-container h2 {
    margin: 0 0 15px 0;
    font-size: 1.8rem;
    font-weight: 800;
}

.no-card-container p {
    margin: 0 0 25px 0;
    color: #aaa;
    line-height: 1.6;
    max-width: 280px;
}

.no-card-container a {
    background-color: var(--accent-purple);
    color: var(--text-dark);
    padding: 12px 25px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 700;
    transition: transform 0.2s ease-out;
}

.no-card-container a:hover {
    transform: scale(1.05);
}

/* --- AI Controls Styles --- */
.ai-container {
    width: 100%;
    min-height: 200px;
    background-color: var(--dark-bg);
    padding: 25px;
    border-radius: 20px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.ai-view {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
}
.ai-view.active {
    display: flex;
}

/* --- Start View Styles --- */
#startView h1 {
    text-align: center;
    margin: 0 0 20px 0;
    font-size: 1.5rem;
}
.controls { width: 100%; }
.button {
    width: 100%;
    padding: 15px;
    display: none;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 700;
    transition: background-color 0.2s, transform 0.1s;
}
#startButton {
    display: none;
    background-color: var(--accent-green);
    color: var(--text-dark);
}

/* --- Conversation View & Waveform Animation --- */
#conversationView {
    cursor: pointer;
}

.waveform {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 70px;
}

.waveform span {
    width: 12px;
    height: 10px;
    background-color: white;
    border-radius: 50px;
    transition: height 0.3s ease-out;
}

.waveform.speaking span {
    animation-name: soundwave;
    animation-duration: 1.2s;
    animation-timing-function: ease-in-out;
    animation-iteration-count: infinite;
}

.waveform.speaking span:nth-child(2) { animation-delay: 0.2s; }
.waveform.speaking span:nth-child(3) { animation-delay: 0.4s; }
.waveform.speaking span:nth-child(4) { animation-delay: 0.6s; }

@keyframes soundwave {
    0%   { height: 10px; }
    25%  { height: 70px; }
    50%  { height: 25px; }
    75%  { height: 50px; }
    100% { height: 10px; }
}

.end-button {
    position: absolute;
    bottom: 20px;
    width: 50px;
    height: 50px;
    margin-top: 25px;
    border-radius: 50%;
    border: none;
    background-color: var(--accent-red-dark);
    color: white;
    font-size: 1.8rem;
    cursor: pointer;
    transition: background-color 0.2s;
}
.end-button:hover {
    background-color: var(--accent-red);
}

/* --- CREATE YOUR OWN BUTTON STYLES --- */
.cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 15px 30px;
  border: 0;
  position: relative;
  overflow: hidden;
  border-radius: 10rem;
  transition: all 0.02s;
  font-weight: bold;
  color: rgb(37, 37, 37);
  z-index: 0;
  box-shadow: 0 0px 7px -5px rgba(0, 0, 0, 0.5);
  width: auto; /* Allow button to size to its content */
}

.cta-button:hover {
  background: rgb(193, 228, 248);
  color: rgb(33, 0, 85);
}

.cta-button:active {
  transform: scale(0.97);
}

.cta-button .hoverEffect {
  position: absolute;
  bottom: 0;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: -1;
}

.cta-button .hoverEffect div {
  background: rgb(222, 0, 75);
  background: linear-gradient(
    90deg,
    rgba(222, 0, 75, 1) 0%,
    rgba(191, 70, 255, 1) 49%,
    rgba(0, 212, 255, 1) 100%
  );
  border-radius: 40rem;
  width: 10rem;
  height: 10rem;
  transition: 0.4s;
  filter: blur(20px);
  animation: effect infinite 3s linear;
  opacity: 0.5;
}

.cta-button:hover .hoverEffect div {
  width: 8rem;
  height: 8rem;
}

@keyframes effect {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

/* --- SOCIAL ICON STYLES (CORRECTED) --- */
.wrapper {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 0;
  margin: 0;
}

.wrapper .icon {
  position: relative;
  /* CHANGED: Switched background to a dark panel color for high contrast */
  background: var(--panel-bg); 
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  box-shadow: 0 10px 10px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.68, -0.55, 0.265, 1.55);

  /* ADDED: Explicitly set the icon's logo color to be light */
  color: var(--text-light);
}
.wrapper .tooltip {
  position: absolute;
  top: 50%;
  /* CHANGED: Positioned to the left of the icon */
  right: 65px; 
  transform: translateY(-50%);
  font-size: 14px;
  background: #fff;
  color: #fff;
  padding: 5px 8px;
  border-radius: 5px;
  box-shadow: 0 10px 10px rgba(0, 0, 0, 0.1);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.wrapper .tooltip::before {
  position: absolute;
  content: "";
  height: 8px;
  width: 8px;
  background: #fff;
  /* CHANGED: Positioned arrow on the right edge of the tooltip */
  right: -3px;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.wrapper .icon:hover .tooltip {
  /* CHANGED: Animate further to the left */
  right: 75px;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.wrapper .icon:hover span,
.wrapper .icon:hover .tooltip {
  text-shadow: 0px -1px 0px rgba(0, 0, 0, 0.1);
}

.wrapper .facebook:hover,
.wrapper .facebook:hover .tooltip,
.wrapper .facebook:hover .tooltip::before {
  background: #1877f2;
  color: #fff;
}

.wrapper .twitter:hover,
.wrapper .twitter:hover .tooltip,
.wrapper .twitter:hover .tooltip::before {
  background: #1da1f2;
  color: #fff;
}

.wrapper .instagram:hover,
.wrapper .instagram:hover .tooltip,
.wrapper .instagram:hover .tooltip::before {
  background: #e4405f;
  color: #fff;
}

@media (min-width: 769px) {

    .page-container {
        /*
          This is the key change. We are switching from a flexible
          max-width to a fixed width on desktop. This stabilizes
          the layout and prevents the card from resizing.
        */
        width: 375px;
    }

}
/* --- Media Query for Mobile View --- */
@media (max-width: 768px) {

    .card-hint {
        bottom: -30px;
        font-size: 0.8rem;
        padding: 8px 16px;
    }

    /* --- Corrected Mobile Layout --- */
    .site-grid {
        /* Change to a flexible column layout */
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 30px;

        /* Reset desktop grid styles */
        grid-template-columns: 1fr;
    }

    .wrapper {
        /* Position icons at the top of the flex container */
        order: 1;

        /* Arrange icons in a row */
        flex-direction: row;
        gap: 20px; /* Adjust spacing for horizontal layout */

        /* Reset desktop grid styles */
        grid-column: auto;
        justify-self: center;
    }

    .page-container {
        /* Position the main content below the icons */
        order: 2;
        
        /* Reset desktop grid styles */
        grid-column: auto;
    }


    /* --- Mobile Social Icon Styles --- */

    /* Hide the tooltip on mobile devices */
    .wrapper .tooltip {
        display: none;
    }

    /* Disable hover effects like scaling and shadows on mobile */
    .wrapper .icon:hover,
    .wrapper .icon:active {
        transform: none;
        text-shadow: none;
    }
    
    /* Apply brand colors directly to the icons on mobile */
    .wrapper .facebook {
        background: #1877f2;
        color: #fff;
    }

    .wrapper .twitter {
        background: #1da1f2;
        color: #fff;
    }

    .wrapper .instagram {
        background: #e4405f;
        color: #fff;
    }

    /* Override the hover styles to prevent color changes on tap */
    .wrapper .facebook:hover,
    .wrapper .facebook:hover .tooltip,
    .wrapper .facebook:hover .tooltip::before {
        background: #1877f2;
        color: #fff;
    }

    .wrapper .twitter:hover,
    .wrapper .twitter:hover .tooltip,
    .wrapper .twitter:hover .tooltip::before {
        background: #1da1f2;
        color: #fff;
    }

    .wrapper .instagram:hover,
    .wrapper .instagram:hover .tooltip,
    .wrapper .instagram:hover .tooltip::before {
        background: #e4405f;
        color: #fff;
    }
}