/* Farmbook AI - Shared Styles */

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

:root {
    --primary: #4CAF50;
    --primary-dark: #388E3C;
    --primary-light: #81C784;
    --accent: #FF9800;
    --success: #4CAF50;
    --warning: #FFC107;
    --danger: #F44336;
    --info: #2196F3;
    --surface: #FFFFFF;
    --background: #F5F5F5;
    --text-primary: #212121;
    --text-secondary: #757575;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.15);
}

body {
    font-family: 'Sarabun', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin: 0;
}

/* Mobile Frame */
.mobile-frame {
    max-width: 390px;
    width: 100%;
    height: 100vh;
    max-height: 100vh;
    margin: 0 auto;
    background: #1a1a1a;
    border-radius: 40px;
    padding: 10px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.1);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-frame::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 120px;
    height: 25px;
    background: #1a1a1a;
    border-radius: 0 0 20px 20px;
    z-index: 10;
}

.mobile-frame::after {
    content: '';
    position: absolute;
    top: 28px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 6px;
    background: #333;
    border-radius: 3px;
    z-index: 11;
}

.container {
    width: 100%;
    height: calc(100vh - 20px);
    background: var(--surface);
    position: relative;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.1);
    border-radius: 30px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Adjust for very small screens */
@media (max-width: 480px) {
    .mobile-frame {
        border-radius: 0;
        padding: 0;
        max-width: 100%;
    }
    .mobile-frame::before,
    .mobile-frame::after {
        display: none;
    }
    .container {
        border-radius: 0;
        height: 100vh;
    }
}

@media (max-height: 600px) {
    .mobile-frame {
        border-radius: 20px;
        padding: 6px;
    }
    .container {
        border-radius: 15px;
        height: calc(100vh - 12px);
    }
}

/* Status Bar */
.status-bar {
    background: var(--primary);
    padding: 8px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    font-size: 14px;
}

/* App Header */
.app-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    padding: 16px 20px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-header.with-back {
    justify-content: flex-start;
    gap: 16px;
}

.back-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
}

.app-title-container {
    flex: 1;
}

.app-title {
    font-size: 18px;
    font-weight: 700;
}

.app-subtitle {
    font-size: 11px;
    opacity: 0.9;
}

.header-icons {
    display: flex;
    gap: 12px;
}

.icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    transition: all 0.3s;
    position: relative;
}

.icon-btn:hover {
    background: rgba(255,255,255,0.3);
}

/* Content Area */
.content {
    padding: 0 0 80px 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.content-padding {
    padding: 16px;
}

/* Section Title */
.section-title {
    padding: 20px 16px 12px;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 12px;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.card-title {
    font-size: 16px;
    font-weight: 700;
}

.card-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

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

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

.btn-primary:hover {
    background: var(--primary-dark);
}

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

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

.btn-block {
    width: 100%;
    justify-content: center;
}

/* Floating Button */
.floating-btn {
    position: absolute;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
    transition: all 0.3s;
    z-index: 90;
    animation: float 3s ease-in-out infinite;
}

.floating-btn:hover {
    transform: scale(1.1);
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.chatbot-btn {
    bottom: 90px;
    right: 20px;
    background: linear-gradient(135deg, #9C27B0, #7B1FA2);
}

/* Bottom Navigation */
.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--surface);
    display: flex;
    justify-content: space-around;
    padding: 8px 0 12px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 100;
    border-radius: 0 0 30px 30px;
}

.nav-btn {
    background: none;
    border: none;
    padding: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.3s;
    text-decoration: none;
}

.nav-btn.active {
    color: var(--primary);
}

.nav-label {
    font-size: 10px;
    font-weight: 600;
}

/* Loading */
.loading {
    display: none;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.loading.active {
    display: flex;
}

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

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Badge */
.badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    display: inline-block;
}

.badge-primary { background: #E8F5E9; color: #388E3C; }
.badge-warning { background: #FFF3E0; color: #F57C00; }
.badge-danger { background: #FFEBEE; color: #D32F2F; }
.badge-info { background: #E3F2FD; color: #1976D2; }

/* Alert */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.alert-warning {
    background: #FFF3E0;
    border-left: 4px solid #FF9800;
}

.alert-danger {
    background: #FFEBEE;
    border-left: 4px solid #F44336;
}

.alert-info {
    background: #E3F2FD;
    border-left: 4px solid #2196F3;
}

.alert-success {
    background: #E8F5E9;
    border-left: 4px solid #4CAF50;
}

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

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--background);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* List */
.list {
    list-style: none;
}

.list-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--background);
    cursor: pointer;
    transition: background 0.3s;
}

.list-item:hover {
    background: var(--background);
}

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

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--background);
    margin-bottom: 16px;
}

.tab {
    flex: 1;
    padding: 12px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.3s;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

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

.slide-up {
    animation: slideUp 0.3s ease;
}

/* Responsive */
@media (max-width: 400px) {
    .app-title {
        font-size: 16px;
    }

    .section-title {
        font-size: 16px;
    }
}
