:root {
    --bg: #f0f2f5;
    --card-bg: #ffffff;
    --text: #1a1a1a;
    --subtext: #666;
    --accent: #007aff;
    --danger: #ff3b30;
    --shadow: 0 8px 30px rgba(0,0,0,0.12);
    --radius: 24px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg);
    color: var(--text);
    height: 100vh;
    display: flex;
    justify-content: center;
    overflow: hidden;
}

#app {
    width: 100%;
    max-width: 640px;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

#card-container {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    perspective: 1000px;
    padding: 20px;
}

/* Card Styles */
.card-scene {
    width: 100%;
    max-width: 340px;
    aspect-ratio: 9/16;
    max-height: 600px;
    position: relative;
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    /* Add perspective to the scene to create 3D depth */
    perspective: 1500px;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    /* Use a spring-like bezier for more realism */
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
    cursor: pointer;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

/* Add a slight lifting effect when flipping */
.card-scene.flipped .card-inner {
    transform: rotateY(180deg) scale(1.02);
    box-shadow: 0 20px 50px rgba(0,0,0,0.15);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: var(--radius);
    background: var(--card-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    /* Ensure faces are rendered nicely in 3D */
    transform-style: preserve-3d;
}

/* Front face needs z-index to stay on top initially */
.card-face:first-child {
    z-index: 2;
    transform: rotateY(0deg);
}

.card-back {
    transform: rotateY(180deg);
    background: #f8f9fa;
    z-index: 1;
}

/* QR and Info */
.qr-wrapper {
    margin-bottom: 32px;
    padding: 16px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.card-name {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

.card-role {
    font-size: 1rem;
    font-weight: 500;
    color: var(--subtext);
    margin-bottom: 4px;
}

.card-detail {
    font-size: 0.95rem;
    color: var(--subtext);
    margin: 4px 0;
}

/* Action Buttons */
.action-btn {
    width: 100%;
    padding: 16px;
    margin: 8px 0;
    border: none;
    border-radius: 16px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.1s;
}

.action-btn:active {
    transform: scale(0.98);
}

.share-btn {
    background-color: var(--accent);
    color: white;
}

.edit-btn {
    background-color: var(--text);
    color: white;
}

.delete-btn {
    background-color: rgba(255, 59, 48, 0.1);
    color: var(--danger);
}

/* Add Card Placeholder */
.add-card-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.8);
    border-radius: var(--radius);
    border: 3px dashed #ddd;
    color: #999;
}

.add-icon {
    font-size: 4rem;
    margin-bottom: 16px;
    color: #ccc;
}

/* Indicators */
#indicators {
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: #ddd;
    transition: all 0.3s;
}

.dot.active {
    width: 24px;
    background-color: var(--text);
    border-radius: 12px;
}

/* Modal */
#modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

#modal {
    background: white;
    width: 100%;
    max-width: 400px;
    padding: 32px;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    animation: slideUp 0.3s ease-out;
}

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

#modal h2 {
    margin-bottom: 24px;
    font-size: 1.5rem;
    text-align: center;
}

form input {
    width: 100%;
    padding: 16px;
    margin-bottom: 12px;
    background: #f5f5f5;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    outline: none;
    transition: background 0.2s;
}

form input:focus {
    background: #eef2ff;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.form-actions button {
    flex: 1;
    padding: 16px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

#save-btn {
    background: var(--text);
    color: white;
}

#cancel-btn {
    background: #f5f5f5;
    color: var(--text);
}

.hidden {
    display: none !important;
}
