:root {
    color-scheme: light;
    --primary-color: #2d4899;
    --secondary-color: #4da83c;
    --bg-light: #ffffff;
    --text-dark: #333333;
    --text-gray: #666666;
    --grid-gray: #f3f4f6;
    --grid-green: #e8f5e9;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Calibri', sans-serif;
}

html {
    background-color: #ffffff !important;
}

body {
    background-color: #ffffff !important;
    height: 100vh;
    /* Fixed height */
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    /* Prevent scroll */
    padding: 0;
    /* Remove padding to maximize space */
}

/* Scene for 3D Flip */
.scene {
    width: 100%;
    max-width: 400px;
    height: 740px;
    /* Increased height for footer */
    /* Adjust based on content */
    perspective: 1000px;
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    /* No gap, they touch */
    width: 100%;
    margin-bottom: 2rem;
    border-radius: 5px;
    overflow: hidden;
    flex-shrink: 0;
    /* Prevent shrinking */
}

.card {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 1s;
    transform-style: preserve-3d;
    background-color: #ffffff !important;
}

.card.is-flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    background-color: #ffffff !important;
    background-image: none !important;
    border-radius: 5px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem 1.5rem;
    text-align: center;
}

.card-back {
    transform: rotateY(180deg);
    background-color: #ffffff !important;
}

/* Logo */
.logo-container {
    margin-bottom: 1rem;
    /* Reduced */
    width: 100%;
}

.company-logo {
    max-width: 80%;
    height: auto;
}

/* Profile Section */
.profile-section {
    margin-bottom: 1rem;
    /* Reduced */
    width: 100%;
}

.profile-pic {
    width: 180px;
    height: 180px;
    object-fit: cover;
    object-position: top;
    border-radius: 5px;
    /* Square with slight radius */
    margin-bottom: 1rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.25rem;
}

.designation {
    font-size: 1.1rem;
    color: #000;
    font-weight: 400;
}

/* Actions Grid */
.actions-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    /* No gap, they touch */
    width: 100%;
    margin-bottom: 1.5rem;
    /* Reduced */
    border-radius: 5px;
    overflow: hidden;
    flex-shrink: 0;
    /* Prevent shrinking */
}

.grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.2rem 0.5rem;
    /* Uniform padding for ALL items */
    text-decoration: none;
    color: #000;
    transition: opacity 0.2s;
}

.grid-item:hover {
    opacity: 0.8;
}

.grid-item.gray {
    background-color: var(--grid-gray);
}

.grid-item.green {
    background-color: var(--grid-green);
}

.icon-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    flex-shrink: 0;
    /* Prevent shrinking */
}

.icon-circle i {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    line-height: 1;
    /* Reset line-height */
}

.grid-item span {
    font-size: 0.85rem;
    font-weight: 500;
}

/* Save Button */
.save-btn {
    width: 100%;
    padding: 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    /* Changed from auto to fixed small margin */
    /* Push footer to bottom */
    box-shadow: 0 4px 6px rgba(45, 72, 153, 0.2);
    transition: background-color 0.3s;
}

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

.footer-link {
    margin-top: 0;
    /* Removed extra margin */
}

.footer-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

/* Back Face Styles */
.qr-section {
    margin: 2rem 0;
}

#qrcode img {
    margin: 0 auto;
}

.qr-section p {
    margin-top: 0.5rem;
    color: var(--text-gray);
    font-size: 0.9rem;
}

.company-details {
    width: 100%;
    text-align: center;
    margin-top: 3rem;
}

.company-name-large {
    color: var(--primary-color);
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.office-details {
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    color: #000;
    line-height: 1.4;
}

.office-details h4 {
    color: var(--primary-color);
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
}

/* Social Media Links */
.social-links {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 1.5rem 0;
}

.social-links a {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 1.2rem;
    transition: transform 0.3s, background-color 0.3s;
}

.social-links a:hover {
    transform: scale(1.1);
    background-color: var(--secondary-color);
}

.cin-details {
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.iso-footer {
    margin-top: auto;
    font-size: 0.75rem;
    font-weight: 600;
    color: #000;
}

/* Bottom Color Bar */
.bottom-color-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 10px;
    background: linear-gradient(to right,
            var(--primary-color) 0%,
            var(--primary-color) 25%,
            var(--secondary-color) 25%,
            var(--secondary-color) 50%,
            #f59e0b 50%,
            #f59e0b 75%,
            #ef4444 75%,
            #ef4444 100%);
    z-index: 100;
}

/* Flip Control Button */
.flip-control-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--secondary-color);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    z-index: 99;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.3s;
}

.flip-control-btn:hover {
    background: #3d8b30;
    /* Darker green */
    color: white;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    body {
        padding: 0;
        overflow-y: auto;
        height: auto;
        min-height: 100vh;
        align-items: flex-start;
        /* Align to top on mobile */
    }

    .scene {
        max-width: 100%;
        height: auto;
        min-height: 100vh;
        /* Full height */
    }

    .card-face {
        padding: 1.5rem 1rem;
        background-color: #ffffff !important;
        background-image: none !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        min-height: 100vh;
        /* Ensure it covers full height */
    }

    .profile-pic {
        width: 150px;
        height: 150px;
    }

    .name {
        font-size: 1.3rem;
    }

    .designation {
        font-size: 1rem;
    }

    .grid-item {
        padding: 1rem 0.3rem;
    }

    .grid-item span {
        font-size: 0.75rem;
    }

    .icon-circle {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .save-btn {
        font-size: 1rem;
        padding: 0.9rem;
    }

    .flip-control-btn {
        bottom: 20px;
        right: 20px;
        padding: 8px 16px;
        font-size: 0.9rem;
    }

    .company-name-large {
        font-size: 1.1rem;
    }

    .office-details {
        font-size: 0.85rem;
    }

    .social-links a {
        width: 35px;
        height: 35px;
        font-size: 1.1rem;
    }
}

@media (max-width: 360px) {
    .profile-pic {
        width: 130px;
        height: 130px;
    }

    .name {
        font-size: 1.2rem;
    }

    .grid-item {
        padding: 0.8rem 0.2rem;
    }

    .icon-circle {
        width: 30px;
        height: 30px;
        font-size: 0.9rem;
    }
}