/*
 * Components.css
 * Reusable component styles: buttons, cards, forms, etc.
 */

/* ============================================
   Buttons
   ============================================ */

.btn {
    display: inline-block;
    padding: 1rem 2.5rem;
    background: var(--primary-blue);
    color: white;
    border-radius: var(--radius-pill);
    font-size: 1.1rem;
    font-weight: 500;
    transition: all var(--transition-normal);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(61, 190, 219, 0.2);
    text-align: center;
}

.btn:hover {
    background: var(--dark-blue);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(61, 190, 219, 0.3);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    /* Default button style */
}

.btn-secondary {
    background: transparent;
    color: var(--primary-blue);
    border: 2px solid var(--primary-blue);
    box-shadow: none;
}

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

.btn-large {
    padding: 1.25rem 3rem;
    font-size: 1.15rem;
    font-weight: 600;
}

.btn-teal {
    background: var(--accent-teal);
    box-shadow: 0 4px 12px rgba(61, 190, 219, 0.25);
}

.btn-teal:hover {
    background: var(--accent-teal-dark);
    box-shadow: 0 8px 24px rgba(61, 190, 219, 0.35);
}

/* ============================================
   Cards
   ============================================ */

.feature-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.4s ease;
    text-align: center;
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(61, 190, 219, 0.15);
    border-color: rgba(61, 190, 219, 0.3);
}

.feature-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-blue), #5DD5F0);
    border-radius: 16px;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.feature-card h3 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.feature-card p {
    font-size: 1rem;
    color: var(--text-gray);
    line-height: 1.6;
    text-align: center;
    margin: 0;
}

/* Dashboard Cards */
.dashboard-card {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: var(--radius-md);
    animation: slideUp 0.6s ease both;
    cursor: pointer;
    height: 180px;
    width: 100%;
    position: relative;
    flex-shrink: 0;
    box-shadow: var(--shadow-sm);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    padding: 1.5rem;
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-front {
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    opacity: 1;
    transform: scale(1);
    z-index: 2;
}

.card-back {
    background: linear-gradient(135deg, var(--primary-blue) 0%, #2EB8D6 100%);
    color: white;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    text-align: left;
    padding: 1rem;
    opacity: 0;
    transform: scale(0.95);
    z-index: 1;
}

.dashboard-card.flipped {
    background: linear-gradient(135deg, var(--primary-blue) 0%, #2EB8D6 100%);
    border-color: var(--primary-blue);
}

.dashboard-card.flipped .card-front {
    opacity: 0;
    transform: scale(0.95);
    pointer-events: none;
}

.dashboard-card.flipped .card-back {
    opacity: 1;
    transform: scale(1);
}

.dashboard-card:hover {
    box-shadow: 0 12px 32px rgba(61, 190, 219, 0.15);
    border-color: rgba(61, 190, 219, 0.3);
    transform: translateY(-2px);
}

.dashboard-card.flipped:hover {
    box-shadow: 0 12px 32px rgba(61, 190, 219, 0.3);
}

.dashboard-card:nth-child(1) {
    animation-delay: 0.1s;
}

.dashboard-card:nth-child(2) {
    animation-delay: 0.2s;
}

.dashboard-card:nth-child(3) {
    animation-delay: 0.3s;
}

.card-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-blue), #5DD5F0);
    border-radius: 10px;
    margin-bottom: 1rem;
    position: relative;
    z-index: 1;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.dashboard-card:hover .card-icon {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(61, 190, 219, 0.3);
}

/* Card Back Styles */
.card-back-icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    opacity: 0.95;
}

.card-back h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    color: white;
}

.card-back p {
    font-size: 0.7rem;
    line-height: 1.3;
    margin-bottom: 0.5rem;
    opacity: 0.95;
    color: white;
}

.card-back ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.card-back ul li {
    font-size: 0.65rem;
    padding: 0.2rem 0;
    padding-left: 0.9rem;
    position: relative;
    opacity: 0.9;
    color: white;
    line-height: 1.2;
}

.card-back ul li::before {
    content: '✓';
    position: absolute;
    left: 0;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.7rem;
}

.card-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
    transition: color 0.3s ease;
}

.dashboard-card:hover .card-title {
    color: var(--primary-blue);
}

.card-bar {
    height: 4px;
    background: var(--bg-light);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.card-bar-fill {
    height: 100%;
    background: var(--primary-blue);
    width: 0%;
    border-radius: 2px;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.card-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5));
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

/* Animate bars when visible */
.dashboard-card.animate-bar .card-bar-fill {
    width: var(--bar-width, 70%);
}

.dashboard-card:nth-child(1) .card-bar-fill {
    --bar-width: 85%;
}

.dashboard-card:nth-child(2) .card-bar-fill {
    --bar-width: 72%;
}

.dashboard-card:nth-child(3) .card-bar-fill {
    --bar-width: 93%;
}

/* ============================================
   Forms
   ============================================ */

.form {
    width: 100%;
}

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

.form-group label {
    display: block;
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 1rem 1.25rem;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: var(--font-family);
    transition: all var(--transition-normal);
    background: var(--bg-white);
    color: var(--text-dark);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 4px rgba(61, 190, 219, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 150px;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-gray);
    opacity: 0.6;
}

/* ============================================
   Success Message
   ============================================ */

.success-message {
    display: none;
    text-align: center;
    padding: 3rem;
}

.success-message.show {
    display: block;
    animation: fadeIn 0.6s ease;
}

.success-message h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-dark);
}

.success-message p {
    font-size: 1.15rem;
    color: var(--text-gray);
}

.checkmark {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #34C759;
    margin: 0 auto 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: scaleIn 0.5s ease;
}

.checkmark::after {
    content: '✓';
    font-size: 3rem;
    color: white;
    font-weight: bold;
}

/* ============================================
   Animations
   ============================================ */

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}

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

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

/* Fade-in for scroll animations */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   Mobile Responsive
   ============================================ */

@media (max-width: 768px) {
    /* Buttons */
    .btn {
        padding: 0.875rem 2rem;
        font-size: 1rem;
        /* Increase touch target size */
        min-height: 44px;
    }

    .btn-large {
        padding: 1rem 2.5rem;
        font-size: 1.05rem;
        min-height: 48px;
    }

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

    .form-group label {
        font-size: 0.9rem;
        margin-bottom: 0.4rem;
    }

    .form-group input,
    .form-group textarea {
        padding: 0.875rem 1rem;
        font-size: 16px; /* Prevents zoom on iOS */
        /* Increase touch target size */
        min-height: 44px;
    }

    .form-group textarea {
        min-height: 120px;
    }

    /* Feature Cards */
    .feature-card {
        padding: 2rem 1.5rem;
    }

    .feature-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .feature-card h3 {
        font-size: 1.2rem;
        margin-bottom: 0.75rem;
    }

    .feature-card p {
        font-size: 0.95rem;
    }

    /* Dashboard Cards */
    .dashboard-card {
        height: 160px;
    }

    .card-icon {
        width: 35px;
        height: 35px;
        font-size: 1.1rem;
        margin-bottom: 0.75rem;
    }

    .card-title {
        font-size: 0.85rem;
        margin-bottom: 0.4rem;
    }

    .card-back {
        padding: 0.875rem;
    }

    .card-back h3 {
        font-size: 0.95rem;
        margin-bottom: 0.3rem;
    }

    .card-back p {
        font-size: 0.65rem;
        margin-bottom: 0.4rem;
    }

    .card-back ul li {
        font-size: 0.6rem;
        padding: 0.15rem 0;
        padding-left: 0.8rem;
    }

    /* Success Message */
    .success-message {
        padding: 2rem 1rem;
    }

    .success-message h2 {
        font-size: 1.5rem;
        margin-bottom: 0.75rem;
    }

    .success-message p {
        font-size: 1rem;
    }

    .checkmark {
        width: 60px;
        height: 60px;
        margin-bottom: 1rem;
    }

    .checkmark::after {
        font-size: 2.5rem;
    }
}

/* Tablet Optimization */
@media (min-width: 769px) and (max-width: 1024px) {
    .btn {
        padding: 0.95rem 2.25rem;
    }

    .btn-large {
        padding: 1.15rem 2.75rem;
    }

    .feature-card {
        padding: 2.25rem 2rem;
    }

    .dashboard-card {
        height: 170px;
    }
}

/* Small Mobile Devices */
@media (max-width: 480px) {
    /* Buttons - Optimized for small screens */
    .btn {
        padding: 0.8rem 1.75rem;
        font-size: 0.95rem;
        min-height: 42px;
    }

    .btn-large {
        padding: 0.875rem 2.25rem;
        font-size: 1rem;
        min-height: 46px;
    }

    /* Forms - Better for small touch screens */
    .form-group {
        margin-bottom: 1rem;
    }

    .form-group label {
        font-size: 0.85rem;
    }

    .form-group input,
    .form-group textarea {
        padding: 0.8rem 0.875rem;
        font-size: 16px; /* Prevents zoom */
        min-height: 42px;
    }

    .form-group textarea {
        min-height: 100px;
    }

    /* Feature Cards */
    .feature-card {
        padding: 1.75rem 1.25rem;
    }

    .feature-icon {
        width: 45px;
        height: 45px;
        font-size: 1.35rem;
        margin-bottom: 0.875rem;
    }

    .feature-card h3 {
        font-size: 1.1rem;
        margin-bottom: 0.625rem;
    }

    .feature-card p {
        font-size: 0.9rem;
    }

    /* Dashboard Cards */
    .dashboard-card {
        height: 140px;
    }

    .card-icon {
        width: 32px;
        height: 32px;
        font-size: 1rem;
        margin-bottom: 0.625rem;
    }

    .card-title {
        font-size: 0.8rem;
        margin-bottom: 0.35rem;
    }

    .card-bar {
        height: 3px;
    }

    .card-back {
        padding: 0.75rem;
    }

    .card-back-icon {
        font-size: 1.3rem;
        margin-bottom: 0.25rem;
    }

    .card-back h3 {
        font-size: 0.9rem;
        margin-bottom: 0.25rem;
    }

    .card-back p {
        font-size: 0.6rem;
        margin-bottom: 0.35rem;
    }

    .card-back ul li {
        font-size: 0.55rem;
        padding: 0.125rem 0;
        padding-left: 0.7rem;
    }

    .card-back ul li::before {
        font-size: 0.65rem;
    }

    /* Success Message */
    .success-message {
        padding: 1.75rem 0.875rem;
    }

    .success-message h2 {
        font-size: 1.35rem;
        margin-bottom: 0.625rem;
    }

    .success-message p {
        font-size: 0.95rem;
    }

    .checkmark {
        width: 55px;
        height: 55px;
        margin-bottom: 0.875rem;
    }

    .checkmark::after {
        font-size: 2.25rem;
    }
}
