/* Vehicle Grading System - Points Based Mobile Styles */
:root {
    --color-grade-1: #28a745;
    --color-grade-2: #6c757d;
    --color-grade-3: #ffc107;
    --color-grade-4: #fd7e14;
    --color-grade-5: #dc3545;
    --primary-bg: #f5f5f5;
    --card-bg: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--primary-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header with Grade Display */
.grading-header {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    position: sticky;
    top: 0;
    z-index: 100;
}

.grading-header h1 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.grade-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    position: relative;
}

.grade-badge-points-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    height: 60px;
    margin: 0 auto;
}

.warning-icon {
    position: absolute;
    right: calc(50% - 45px);
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 1 !important;
    user-select: none;
    vertical-align: middle;
    flex-shrink: 0;
    touch-action: manipulation;
}

.grade-badge {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    background: white;
    color: #333;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 2;
}

.points-display {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    font-weight: 500;
    white-space: nowrap;
}

.grade-badge.grade-1 { background: var(--color-grade-1); color: white; }
.grade-badge.grade-2 { background: var(--color-grade-2); color: white; }
.grade-badge.grade-3 { background: var(--color-grade-3); color: #333; }
.grade-badge.grade-4 { background: var(--color-grade-4); color: white; }
.grade-badge.grade-5 { background: var(--color-grade-5); color: white; }

/* Warning Tooltip */
.warning-tooltip {
    position: absolute;
    top: 100%;
    left: 50%;
    margin-top: 0.5rem;
    background: #333;
    color: white;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.5;
    max-width: 300px;
    min-width: 200px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    text-align: center;
    transform: translateX(-50%);
}

.warning-tooltip::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50% !important;
    transform: translateX(-50%) !important;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #333;
}

/* Main Content */
.grading-main {
    flex: 1;
    padding: 0.75rem;
    overflow-y: auto;
}

/* Category Sections */
.categories-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.category-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.category-header {
    position: relative;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.category-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #007bff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
}

/* Category tooltip positioning */
.category-tooltip {
    position: absolute;
    left: 0;
    top: 100%;
    margin-top: 0.5rem;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

/* Item Cards */
.items-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.item-card {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 0.75rem;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 0.5rem;
    align-items: center;
}

.item-info {
    grid-column: 1;
    grid-row: 1;
}

.item-name {
    font-weight: 600;
    font-size: 1rem;
    color: #333;
    margin-bottom: 0.25rem;
}

.item-criteria {
    font-size: 0.75rem;
    color: #666;
    line-height: 1.3;
    margin-bottom: 0.25rem;
}

.item-points {
    font-size: 0.8rem;
    color: #007bff;
    font-weight: 500;
}

.item-controls {
    grid-column: 2;
    grid-row: 1 / 3;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-minus, .btn-plus {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 8px;
    font-size: 1.25rem;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.1s, background 0.2s;
    touch-action: manipulation;
}

.btn-minus {
    background: #dc3545;
    color: white;
}

.btn-plus {
    background: #28a745;
    color: white;
}

.btn-minus:active, .btn-plus:active {
    transform: scale(0.95);
}

.item-count {
    font-size: 1.1rem;
    font-weight: bold;
    min-width: 30px;
    text-align: center;
    color: #333;
}

.subtotal {
    grid-column: 1;
    grid-row: 2;
    font-size: 0.85rem;
    font-weight: 500;
    color: #28a745;
}

/* Action Buttons */
.action-buttons {
    margin-top: 1.5rem;
    padding: 0 0.5rem;
}

.btn-reset {
    width: 100%;
    padding: 1rem;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    touch-action: manipulation;
}

.btn-reset:active {
    background: #545b62;
}

/* Mobile Optimizations */
@media (max-width: 380px) {
    .grading-header h1 {
        font-size: 1.1rem;
    }
    
    .grade-badge {
        width: 45px;
        height: 45px;
        font-size: 1.25rem;
    }
    
    .item-card {
        padding: 0.5rem;
    }
    
    .btn-minus, .btn-plus {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }
}

/* Prevent text selection for better mobile experience */
button {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Focus states for accessibility */
button:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Tooltip Icons */
.item-info {
    position: relative;
}

.item-name {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    user-select: none;
    margin-left: 0.5rem;
    vertical-align: middle;
    flex-shrink: 0;
    touch-action: manipulation;
}

.tooltip-icon:hover {
    opacity: 1;
}

.tooltip-icon svg {
    color: #007bff;
}

/* Warning Icon */
.warning-icon {
    margin-left: 0.5rem;
    align-self: center;
    font-size: 1.2rem;
    transform: translateY(-4px);
}

.warning-icon svg {
    color: #ffc107;
}

.tooltip-content {
    display: none;
    position: absolute;
    background: #333;
    color: white;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.5;
    max-width: 280px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    margin-top: 0.5rem;
}

.tooltip-content ul {
    margin: 0.5rem 0;
    padding-left: 1.2rem;
}

.tooltip-content li {
    margin-bottom: 0.25rem;
}

.tooltip-content strong {
    color: #ffd700;
    display: block;
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
}

.tooltip-content strong:first-child {
    margin-top: 0;
}

.tooltip-content.active {
    display: block;
}

.tooltip-content::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 20px;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid #333;
}

/* Category tooltip - full width */
.category-tooltip {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

/* Mobile tooltip adjustments */
@media (max-width: 480px) {
    .tooltip-content {
        max-width: 250px;
        font-size: 0.8rem;
        padding: 0.75rem;
    }
    
    .category-tooltip {
        max-width: 100%;
    }
}
