/* FormCritter - Digital Pet Game Styles */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #6366f1;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --bg-color: #f3f4f6;
    --card-bg: #ffffff;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
    color: white;
    padding: 20px 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow-lg);
}

header h1 {
    font-size: 2rem;
    font-weight: bold;
}

.header-info {
    display: flex;
    gap: 20px;
    align-items: center;
}

.username {
    font-weight: 500;
}

/* Header Links */
header a {
    color: white;
    text-decoration: none;
}

header a:hover {
    text-decoration: none;
    opacity: 0.9;
}

header a:visited {
    color: white;
}

/* Main Layout */
main {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    main {
        grid-template-columns: 1fr;
    }
}

/* Pet Section */
.pet-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow);
}

.pet-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.pet-display {
    text-align: center;
}

.pet-sprite {
    width: 200px;
    height: 200px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #fef3c7, #fde68a); /* Default, will be overridden by JS */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    transition: transform 0.3s ease, background 0.5s ease;
}

.pet-sprite:hover {
    transform: scale(1.05);
}

.pet-animation {
    font-size: 120px;
    animation: petHeartbeat 1s ease-in-out infinite;
}

@keyframes petHeartbeat {
    0%, 100% { 
        transform: translateY(0) scale(1); 
    }
    10% { 
        transform: translateY(-8px) scale(1.05); 
    }
    20% { 
        transform: translateY(0) scale(1); 
    }
    50% { 
        transform: translateY(-5px) scale(1.02); 
    }
    60% { 
        transform: translateY(0) scale(1); 
    }
}

.pet-sprite.happy .pet-animation {
    animation: petBounce 0.6s ease-in-out infinite;
}

@keyframes petBounce {
    0%, 100% { transform: scale(1) translateY(0); }
    50% { transform: scale(1.1) translateY(-5px); }
}

.pet-sprite.sad .pet-animation {
    filter: grayscale(30%);
    opacity: 0.8;
}

.pet-sprite.hungry .pet-animation {
    animation: petShake 0.5s ease-in-out infinite;
}

@keyframes petShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.pet-sprite.starving .pet-animation {
    animation: petShake 0.3s ease-in-out infinite;
    filter: brightness(0.7);
}

.pet-status h2 {
    font-size: 1.8rem;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.pet-stage, .pet-mood {
    color: var(--text-light);
    font-size: 1rem;
}

/* Stats Container */
.stats-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.stat-bar {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stat-bar label {
    min-width: 120px;
    font-weight: 600;
}

.bar {
    flex: 1;
    height: 24px;
    background: var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.bar-fill {
    height: 100%;
    transition: width 0.5s ease;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.bar-fill.bar-animate {
    animation: barPulse 0.3s ease;
}

@keyframes barPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Stat Colors */
.bar-fill.sated {
    background: linear-gradient(90deg, #ef4444, #dc2626); /* Red */
}

.bar-fill.solaced {
    background: linear-gradient(90deg, #10b981, #059669); /* Green */
}

.bar-fill.edified {
    background: linear-gradient(90deg, #3b82f6, #2563eb); /* Blue */
}

/* Trait Colors */
.bar-fill.athleticism {
    background: linear-gradient(90deg, #ef4444, #dc2626); /* Red */
}

.bar-fill.discipline {
    background: linear-gradient(90deg, #10b981, #059669); /* Green */
}

.bar-fill.intelligence {
    background: linear-gradient(90deg, #3b82f6, #2563eb); /* Blue */
}

/* Other */
.bar-fill.energy {
    background: linear-gradient(90deg, #fbbf24, #fcd34d); /* Yellow */
}

.bar-fill.weight {
    background: linear-gradient(90deg, #06b6d4, #0891b2); /* Cyan */
}

.bar-fill.health {
    background: linear-gradient(90deg, #a855f7, #9333ea); /* Purple */
}

.bar-fill.xp {
    background: linear-gradient(90deg, #fbbf24, #fcd34d);
}

/* Bar with centerline marker */
.bar-with-centerline {
    position: relative;
}

.bar-centerline {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(0, 0, 0, 0.3);
    transform: translateX(-50%);
    z-index: 1;
    pointer-events: none;
}

.bar-centerline::before {
    content: '';
    position: absolute;
    left: 50%;
    top: -4px;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 4px solid rgba(0, 0, 0, 0.3);
}

.bar-centerline::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -4px;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-bottom: 4px solid rgba(0, 0, 0, 0.3);
}

.stat-bar span:last-child {
    min-width: 60px;
    text-align: right;
    font-weight: 600;
    color: var(--text-light);
}

/* Stats Header */
.stats-header {
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.1rem;
    color: var(--primary-color);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 5px;
}

.stats-header:first-child {
    margin-top: 0;
}

/* Stat Info (for weight and total traits) */
.stat-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-color);
    border-radius: 8px;
    margin-top: 10px;
}

.stat-info label {
    font-weight: 600;
    color: var(--text-color);
}

.stat-info span {
    font-weight: 700;
    color: var(--primary-color);
    font-size: 1.1rem;
}

/* Critical animation for low stats */
.pet-sprite.critical .pet-animation {
    animation: petCritical 0.8s ease-in-out infinite;
    filter: brightness(0.6);
}

@keyframes petCritical {
    0%, 100% { transform: scale(0.95); opacity: 0.8; }
    50% { transform: scale(1); opacity: 1; }
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

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

.btn-primary:hover {
    background: #4f46e5;
}

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

.btn-success:hover {
    background: #059669;
}

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

.btn-secondary:hover {
    background: #4b5563;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.875rem;
}

/* Info Section */
.info-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.info-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.info-card h3 {
    margin-bottom: 15px;
    color: var(--primary-color);
    font-size: 1.3rem;
}

/* Inventory */
.inventory-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.category-title {
    margin-top: 10px;
    margin-bottom: 5px;
    color: var(--text-light);
    font-size: 0.9rem;
}

.inventory-category {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.inventory-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-color);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.inventory-item.clickable {
    cursor: pointer;
}

.inventory-item.clickable:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(99, 102, 241, 0.3);
}

.inventory-item.clickable:hover .item-quantity,
.inventory-item.clickable:hover .item-action {
    color: rgba(255, 255, 255, 0.9);
}

.inventory-item.clickable:active {
    transform: translateY(0);
}

.inventory-item .item-icon {
    font-size: 1.5rem;
}

.inventory-item .item-name {
    flex: 1;
    font-weight: 500;
}

.inventory-item .item-quantity {
    color: var(--text-light);
    font-size: 0.9rem;
    min-width: 40px;
    text-align: right;
}

.inventory-item .item-action {
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 4px 8px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 4px;
}

.inventory-hint {
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
    margin: 10px 0;
    font-style: italic;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--card-bg);
    margin: 5% auto;
    border-radius: 12px;
    max-width: 600px;
    box-shadow: var(--shadow-lg);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.close {
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-light);
    cursor: pointer;
    transition: color 0.2s ease;
}

.close:hover {
    color: var(--danger-color);
}

.modal-body {
    padding: 30px;
    max-height: 60vh;
    overflow-y: auto;
}

/* Item Grid */
.item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.item-card, .shop-item {
    background: var(--bg-color);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.item-card:hover, .shop-item:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
}

.item-icon {
    font-size: 3rem;
    margin-bottom: 8px;
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .item-icon {
        font-size: 2.5rem;
        margin-bottom: 6px;
    }
}

.item-name {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 0.95rem;
    line-height: 1.2;
    flex-shrink: 0;
}

.item-quantity {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.item-effects {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 6px;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.item-description {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 8px;
    min-height: 32px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.item-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
    gap: 8px;
    flex-wrap: wrap;
}

.item-price {
    font-weight: 600;
    color: var(--success-color);
}

/* Quantity Controls */
.quantity-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

.quantity-controls label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color);
    margin-right: 5px;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-color);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

.qty-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.qty-btn:active {
    transform: scale(0.95);
}

.qty-input {
    width: 50px;
    height: 28px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0 5px;
}

.qty-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.price-section {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.price-section .item-price {
    font-size: 0.9rem;
    white-space: nowrap;
}

/* Shop Specific */
.shop-categories {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
}

.category-btn {
    padding: 8px 16px;
    border: 2px solid var(--border-color);
    background: white;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.category-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.category-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* PIN Modal Specific */
.pin-modal-content {
    max-width: 400px;
}

.pin-description {
    text-align: center;
    color: var(--text-light);
    margin-bottom: 15px;
}

.pin-item-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--bg-color);
    border-radius: 8px;
    margin-bottom: 20px;
}

.pin-item-info span:first-child {
    font-weight: 600;
}

.pin-item-info span:last-child {
    color: var(--success-color);
    font-weight: 600;
}

.pin-input-container {
    margin-bottom: 20px;
}

.pin-input-container input {
    width: 100%;
    padding: 15px;
    font-size: 1.5rem;
    text-align: center;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    letter-spacing: 8px;
    font-weight: bold;
}

.pin-input-container input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.pin-remember {
    margin-bottom: 20px;
    text-align: center;
}

.pin-remember label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-light);
}

.pin-remember input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.pin-actions {
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.pin-actions .btn {
    flex: 1;
}

.pin-saved-notice {
    text-align: center;
    padding: 10px;
    background: var(--bg-color);
    border-radius: 8px;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--success-color);
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-color);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0;
}

.btn-link:hover {
    color: var(--danger-color);
}

/* Notification */
.notification {
    position: fixed;
    bottom: -100px;
    right: 20px;
    background: var(--card-bg);
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    font-weight: 500;
    transition: bottom 0.3s ease;
    z-index: 2000;
    min-width: 250px;
}

.notification.show {
    bottom: 20px;
}

.notification.success {
    background: var(--success-color);
    color: white;
}

.notification.error {
    background: var(--danger-color);
    color: white;
}

.notification.info {
    background: var(--primary-color);
    color: white;
}

/* Evolution Overlay */
.evolution-overlay {
    display: none;
    position: fixed;
    z-index: 3000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
}

.evolution-overlay.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.evolution-content {
    text-align: center;
    color: white;
    animation: evolutionPulse 1s ease-in-out infinite;
}

.evolution-content h1 {
    font-size: 3rem;
    margin-bottom: 20px;
    background: linear-gradient(45deg, #fbbf24, #f59e0b, #fbbf24);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 2s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.evolution-content p {
    font-size: 1.5rem;
    margin-bottom: 30px;
}

.evolution-animation {
    font-size: 150px;
    animation: evolutionSpin 2s ease-in-out infinite;
}

@keyframes evolutionSpin {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.2); }
    100% { transform: rotate(360deg) scale(1); }
}

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

/* Loading and Empty States */
.loading, .empty, .error {
    text-align: center;
    padding: 20px;
    color: var(--text-light);
}

.error {
    color: var(--danger-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header-info {
        flex-direction: row;
        gap: 10px;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .item-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
    
    .modal-content {
        margin: 5% 10px;
        max-width: calc(100% - 20px);
    }
    
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-header h2 {
        font-size: 1.3rem;
    }
    
    .modal-body {
        padding: 20px 15px;
        max-height: 75vh;
    }
    
    .item-card, .shop-item {
        padding: 10px;
    }
    
    .item-description {
        font-size: 0.75rem;
        min-height: 28px;
        -webkit-line-clamp: 2;
    }
    
    .item-effects {
        font-size: 0.7rem;
    }
    
    .item-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .quantity-controls {
        justify-content: center;
        width: 100%;
    }
    
    .price-section {
        justify-content: center;
        width: 100%;
    }
    
    .price-section .btn {
        flex: 1;
        min-width: 80px;
    }
}

@media (max-width: 480px) {
    .item-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }
    
    .item-card, .shop-item {
        padding: 8px;
    }
    
    .item-name {
        font-size: 0.85rem;
    }
    
    .item-description {
        font-size: 0.7rem;
        min-height: 24px;
    }
    
    .item-effects {
        font-size: 0.65rem;
    }
    
    .quantity-controls label {
        font-size: 0.8rem;
    }
    
    .qty-btn {
        width: 24px;
        height: 24px;
        font-size: 1rem;
    }
    
    .qty-input {
        width: 40px;
        height: 24px;
        font-size: 0.85rem;
    }
    
    .price-section .item-price {
        font-size: 0.85rem;
    }
    
    .price-section .btn {
        font-size: 0.85rem;
        padding: 8px 12px;
    }
    
    .shop-categories {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .category-btn {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
}

