/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', Meiryo, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}

.container {
    max-width: 400px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    color: white;
    font-size: 2rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    margin-bottom: 5px;
}

.version-link {
    text-decoration: none;
    transition: transform 0.2s ease;
}

.version-link:hover {
    transform: scale(1.05);
}

.version {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    font-weight: normal;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.2);
    margin-bottom: 10px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.version:hover {
    color: rgba(255, 255, 255, 1);
}

/* Main sections */
section {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

section h2, section h3 {
    text-align: center;
    color: #4CAF50;
    margin-bottom: 15px;
    font-size: 1.2rem;
}

/* Timer displays */
.timer-display {
    text-align: center;
    font-size: 1.8rem;
    font-weight: bold;
    color: #2E7D32;
    font-family: 'Monaco', 'Menlo', monospace;
}

.timer-display.small {
    font-size: 1.4rem;
    color: #FF6B35;
}

.timer-display span {
    display: inline-block;
    margin: 0 2px;
}

/* Quit status display */
.quit-status {
    background: linear-gradient(135deg, #f8f9fa, #ffffff);
    border-left: 4px solid #4CAF50;
}

.status-display {
    text-align: left;
}

.status-content {
    padding: 10px 0;
}

.status-title {
    font-size: 1.1rem;
    font-weight: bold;
    color: #2E7D32;
    text-align: center;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(76, 175, 80, 0.1);
    border-radius: 8px;
}

.status-positive, .status-symptoms {
    margin-bottom: 15px;
    padding: 12px;
    border-radius: 8px;
}

.status-positive {
    background: rgba(76, 175, 80, 0.05);
    border-left: 3px solid #4CAF50;
}

.status-symptoms {
    background: rgba(255, 152, 0, 0.05);
    border-left: 3px solid #FF9800;
}

.status-positive h4, .status-symptoms h4 {
    font-size: 1rem;
    margin-bottom: 8px;
    color: #333;
    display: flex;
    align-items: center;
}

.status-positive p, .status-symptoms p {
    font-size: 0.9rem;
    line-height: 1.5;
    color: #555;
    margin: 0;
}

/* Craving button */
.craving-button-section {
    text-align: center;
}

.craving-button {
    background: linear-gradient(45deg, #FF6B35, #F7931E);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

.craving-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
}

.craving-button:active {
    transform: translateY(0);
}

/* History */
.history-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.history-item {
    padding: 10px;
    border-bottom: 1px solid #eee;
    font-size: 0.9rem;
}

.history-item:last-child {
    border-bottom: none;
}

.history-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.history-date {
    color: #666;
}

.history-time {
    color: #FF6B35;
    font-weight: bold;
}

.history-interval {
    font-size: 0.8rem;
    color: #999;
    font-style: italic;
    text-align: right;
    margin-top: 2px;
}


/* Empty state */
.empty-history {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 20px 0;
}

/* PWA specific styles */
@media (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    .container {
        padding-top: max(20px, env(safe-area-inset-top));
    }
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}


/* Improved button interactions */
.craving-button {
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.craving-button:before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255,255,255,0.3);
    transition: width 0.6s, height 0.6s, top 0.6s, left 0.6s;
    transform: translate(-50%, -50%);
}

.craving-button:active:before {
    width: 300px;
    height: 300px;
}

/* Smooth scrolling for history */
.history-list {
    scroll-behavior: smooth;
}

.history-list::-webkit-scrollbar {
    width: 8px;
}

.history-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.history-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Enhanced history items */
.history-item {
    transition: background-color 0.2s ease;
    border-radius: 8px;
    margin: 2px 0;
}

.history-item:hover {
    background-color: #f8f9fa;
}

/* Status indicators */
.status-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-good {
    background-color: #4CAF50;
}

.status-warning {
    background-color: #FF9800;
}

.status-danger {
    background-color: #F44336;
}

/* Data management section */
.data-management {
    margin-top: 10px;
}

.data-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.data-button {
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.export-button {
    background: linear-gradient(45deg, #2196F3, #1976D2);
    color: white;
}

.export-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(33,150,243,0.3);
}

.import-button {
    background: linear-gradient(45deg, #4CAF50, #45a049);
    color: white;
}

.import-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76,175,80,0.3);
}

.import-status {
    padding: 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    text-align: center;
    margin-top: 10px;
    display: none;
}

.import-status.success {
    background: rgba(76,175,80,0.1);
    color: #2E7D32;
    border: 1px solid rgba(76,175,80,0.3);
    display: block;
}

.import-status.error {
    background: rgba(244,67,54,0.1);
    color: #C62828;
    border: 1px solid rgba(244,67,54,0.3);
    display: block;
}

/* Responsive design */
@media (max-width: 480px) {
    .container {
        padding: 15px;
    }
    
    .timer-display {
        font-size: 1.5rem;
    }
    
    .timer-display.small {
        font-size: 1.2rem;
    }
    
    header h1 {
        font-size: 1.7rem;
    }
    
    section {
        padding: 15px;
        margin-bottom: 15px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    section {
        background: rgba(255, 255, 255, 0.95);
    }
    
    .history-item:hover {
        background-color: #f0f0f0;
    }
}