:root {
    --primary-pink: #ff69b4;
    --light-pink: #ffb6d9;
    --dark-pink: #ff1493;
    --pale-pink: #fff0f6;
    --text-dark: #333333;
    --text-light: #666666;
    --white: #ffffff;
    --shadow: rgba(255, 105, 180, 0.2);
    --border-radius: 12px;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #fff0f6 0%, #ffe4f0 100%);
    color: var(--text-dark);
    min-height: 100vh;
    line-height: 1.6;
}

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

/* Pages */
.page {
    display: none;
    min-height: 100vh;
    padding: 20px 0;
}

.page.active {
    display: block;
}

/* Logo Container */
.logo-container {
    text-align: center;
    margin-bottom: 40px;
    padding-top: 40px;
}

.logo-container h1 {
    font-size: 2.5em;
    color: var(--primary-pink);
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px var(--shadow);
}

.logo-container .subtitle {
    font-size: 1.1em;
    color: var(--text-light);
}

/* Form Card */
.form-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 30px;
    box-shadow: 0 8px 20px var(--shadow);
    margin-bottom: 20px;
}

.form-card h2, .form-card h3 {
    color: var(--primary-pink);
    margin-bottom: 20px;
    text-align: center;
}

/* Form Groups */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-dark);
    font-weight: 600;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--light-pink);
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-pink);
    box-shadow: 0 0 0 3px rgba(255, 105, 180, 0.1);
}

.form-group input:disabled {
    background-color: #f5f5f5;
    cursor: not-allowed;
    color: #666;
    border-color: #ddd;
}

.form-group small {
    display: block;
    margin-top: 5px;
    color: var(--text-light);
    font-size: 0.85em;
}

/* Image Upload */
.image-upload-container {
    margin-top: 15px;
}

.image-upload-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    border: 2px dashed var(--light-pink);
    border-radius: 8px;
    background: var(--pale-pink);
    cursor: pointer;
    transition: all 0.3s;
}

.image-upload-label:hover {
    border-color: var(--primary-pink);
    background: #ffe4f0;
}

.image-upload-label.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f5f5f5;
    border-color: #ddd;
}

.upload-icon {
    font-size: 24px;
}

.image-preview {
    margin-top: 15px;
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px var(--shadow);
}

.image-preview img {
    width: 100%;
    max-width: 400px;
    height: auto;
    display: block;
    border-radius: 8px;
}

.btn-remove-image {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid var(--primary-pink);
    color: var(--primary-pink);
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.btn-remove-image:hover {
    background: var(--primary-pink);
    color: white;
    transform: scale(1.1);
}

.image-locked {
    opacity: 0.8;
    pointer-events: none;
}

.image-locked .btn-remove-image {
    display: none;
}

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

.btn-primary {
    background: linear-gradient(135deg, var(--primary-pink) 0%, var(--dark-pink) 100%);
    color: var(--white);
    width: 100%;
    box-shadow: 0 4px 12px var(--shadow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--shadow);
}

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

.btn-secondary {
    background: var(--white);
    color: var(--primary-pink);
    border: 2px solid var(--primary-pink);
}

.btn-secondary:hover {
    background: var(--pale-pink);
}

.btn-accent {
    background: linear-gradient(135deg, #ffd700 0%, #ffa500 100%);
    color: var(--white);
    width: 100%;
    font-size: 18px;
    padding: 15px;
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.3);
}

.btn-accent:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 215, 0, 0.4);
}

.btn-admin {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--white);
    width: 100%;
    font-size: 18px;
    padding: 15px;
    margin-top: 10px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-admin:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    background: var(--white);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px var(--shadow);
}

.user-info h2 {
    color: var(--primary-pink);
    margin-bottom: 5px;
}

.user-info p {
    color: var(--text-light);
    font-size: 0.9em;
    margin: 2px 0;
}

/* Weight Lost Display */
.weight-lost-display {
    background: var(--pale-pink);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
    margin: 20px 0;
    border: 2px solid var(--light-pink);
}

.weight-lost-display .label {
    display: block;
    color: var(--text-light);
    margin-bottom: 5px;
}

.weight-lost-display .value {
    display: block;
    font-size: 2em;
    font-weight: bold;
    color: var(--primary-pink);
}

.weight-lost-display .value.positive {
    color: #ff1493;
}

.weight-lost-display .value.negative {
    color: #ff6b6b;
}

/* Messages */
.success-message, .error-message {
    padding: 12px;
    border-radius: 8px;
    margin-top: 15px;
    display: none;
}

.success-message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.success-message.show, .error-message.show {
    display: block;
}

/* Action Buttons */
.action-buttons {
    margin-top: 20px;
}

/* Scoreboard */
.scoreboard-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: 0 8px 20px var(--shadow);
}

/* Admin Dashboard */
.admin-card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.2);
    border: 2px solid #667eea;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #667eea;
}

.admin-header h3 {
    color: #667eea;
    margin: 0;
}

.admin-table-container {
    overflow-x: auto;
    max-height: 600px;
    overflow-y: auto;
}

.admin-table-container table {
    font-size: 0.9em;
}

.admin-table-container table th {
    position: sticky;
    top: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 10;
}

.admin-table-container .image-cell {
    text-align: center;
}

.admin-table-container .image-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.3s;
}

.admin-table-container .image-thumbnail:hover {
    transform: scale(1.5);
    z-index: 100;
}

.admin-table-container .no-image {
    color: #999;
    font-size: 0.85em;
}

.scoreboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.scoreboard-header h3 {
    color: var(--primary-pink);
    margin: 0;
}

.scoreboard-actions {
    display: flex;
    gap: 10px;
}

.btn-print {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
}

.btn-print:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

/* Table */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

table thead {
    background: linear-gradient(135deg, var(--primary-pink) 0%, var(--dark-pink) 100%);
    color: var(--white);
}

table th, table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
}

table th {
    font-weight: 600;
    white-space: nowrap;
}

table tbody tr:hover {
    background: var(--pale-pink);
}

table tbody tr.top-rank-1 {
    background: linear-gradient(90deg, #fff9e6 0%, #ffffff 100%);
}

table tbody tr.top-rank-2 {
    background: linear-gradient(90deg, #f5f5f5 0%, #ffffff 100%);
}

table tbody tr.top-rank-3 {
    background: linear-gradient(90deg, #fff4e6 0%, #ffffff 100%);
}

.rank-medal {
    font-size: 1.2em;
    margin-right: 5px;
}

.weight-change {
    font-weight: bold;
}

.weight-change.positive {
    color: #28a745;
}

.weight-change.negative {
    color: #dc3545;
}

.weight-change.neutral {
    color: var(--text-light);
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-light);
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 9999;
}

.loading-overlay.show {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--light-pink);
    border-top: 4px solid var(--primary-pink);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .logo-container h1 {
        font-size: 2em;
    }

    .form-card {
        padding: 20px;
    }

    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .scoreboard-actions {
        flex-direction: row;
        width: auto;
    }

    table {
        font-size: 0.9em;
    }

    table th, table td {
        padding: 8px 6px;
    }

    .btn {
        padding: 10px 20px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .logo-container h1 {
        font-size: 1.5em;
    }

    .logo-container .subtitle {
        font-size: 1em;
    }

    .form-card {
        padding: 15px;
    }

    table {
        font-size: 0.8em;
    }

    table th, table td {
        padding: 6px 4px;
    }
}
