/**
 * FARMTAG PRO - STYLES
 * Professional, mobile-first design
 */

/* ========================================
   RESET & BASE STYLES
   ======================================== */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

/* ========================================
   SCREENS
   ======================================== */

.screen {
    max-width: 800px;
    margin: 0 auto;
}

.screen.hidden {
    display: none;
}

/* ========================================
   LICENSE SCREEN
   ======================================== */

.license-container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.license-header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: #667eea;
}

.license-header p {
    color: #666;
    font-size: 1.1em;
    margin-bottom: 40px;
}

.license-form {
    max-width: 400px;
    margin: 0 auto;
}

.license-form label {
    display: block;
    text-align: left;
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

.license-form input {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
    border: 2px solid #ddd;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.3s ease;
}

.license-form input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.error-message {
    background: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 8px;
    margin-top: 15px;
    font-size: 0.9em;
}

.error-message.hidden {
    display: none;
}

.loading-message {
    color: #667eea;
    padding: 12px;
    margin-top: 15px;
    font-size: 0.9em;
    font-weight: 600;
}

.loading-message.hidden {
    display: none;
}

/* ========================================
   MAIN APP HEADER
   ======================================== */

.app-header {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-header h1 {
    font-size: 1.8em;
    color: #667eea;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 600;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.status-online {
    background: #e8f5e9;
    color: #2e7d32;
}

.status-online .status-indicator {
    background: #4caf50;
}

.status-offline {
    background: #ffebee;
    color: #c62828;
}

.status-offline .status-indicator {
    background: #f44336;
    animation: none;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========================================
   SESSION BAR
   ======================================== */

.session-bar {
    background: white;
    border-radius: 15px;
    padding: 15px 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.session-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.session-label {
    font-weight: 600;
    color: #666;
}

.tag-count {
    font-size: 1.8em;
    font-weight: bold;
    color: #667eea;
}

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

/* ========================================
   BUTTONS
   ======================================== */

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

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

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn-success {
    background: #4caf50;
    color: white;
}

.btn-success:hover {
    background: #43a047;
}

.btn-warning {
    background: #ff9800;
    color: white;
}

.btn-warning:hover {
    background: #f57c00;
}

/* ========================================
   INPUT SECTIONS
   ======================================== */

.input-section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.input-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.3em;
}

/* Voice Section */
.voice-section {
    text-align: center;
}

.voice-btn {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 1.2em;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 0 auto 15px;
    transition: all 0.3s ease;
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.3);
}

.voice-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.4);
}

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

.voice-btn.listening {
    animation: listening-pulse 1.5s ease-in-out infinite;
    background: linear-gradient(135deg, #f44336 0%, #e91e63 100%);
}

@keyframes listening-pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 8px 30px rgba(244, 67, 54, 0.3);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 12px 50px rgba(244, 67, 54, 0.5);
    }
}

.voice-icon {
    font-size: 3em;
}

.voice-hint {
    color: #666;
    font-size: 0.9em;
}

/* Manual Input */
.manual-input-group {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.manual-input {
    flex: 1;
    padding: 15px;
    font-size: 1.1em;
    border: 2px solid #ddd;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.3s ease;
}

.manual-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.manual-hint {
    color: #666;
    font-size: 0.9em;
}

/* ========================================
   CONFIRMATION BOX
   ======================================== */

.confirmation-box {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    min-width: 320px;
    text-align: center;
}

.confirmation-box.hidden {
    display: none;
}

.confirmation-label {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 10px;
}

.confirmation-tag {
    font-size: 2.5em;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 25px;
    letter-spacing: 3px;
}

.confirmation-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ========================================
   TAGS LIST
   ======================================== */

.tags-section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.tags-section h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.3em;
}

/* Search Container */
.search-container {
    position: relative;
    margin-bottom: 20px;
}

.search-input {
    width: 100%;
    padding: 15px 45px 15px 15px;
    font-size: 1.1em;
    border: 2px solid #ddd;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.search-input::placeholder {
    color: #999;
}

.clear-search-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: #ff9800;
    color: white;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 1.2em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.clear-search-btn:hover {
    background: #f57c00;
    transform: translateY(-50%) scale(1.1);
}

.clear-search-btn.hidden {
    display: none;
}

/* Search Results Info */
.search-results-info {
    padding: 10px;
    margin-bottom: 10px;
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    border-radius: 5px;
    font-size: 0.95em;
    color: #1976d2;
}

.search-no-results {
    padding: 40px 20px;
    text-align: center;
    color: #999;
}

.search-no-results-icon {
    font-size: 3em;
    margin-bottom: 10px;
}

.search-no-results-text {
    font-size: 1.1em;
    font-weight: 600;
    color: #666;
}

/* Highlight Matched Text */
.tag-number mark {
    background: #ffeb3b;
    color: #333;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: bold;
}

.tag-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    max-height: 500px;
    overflow-y: auto;
    padding: 10px;
}

.tag-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tag-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.tag-card.tag-new {
    background: linear-gradient(135deg, #4caf50 0%, #8bc34a 100%);
}

.tag-badge {
    position: absolute;
    top: 5px;
    left: 5px;
    background: rgba(255, 255, 255, 0.3);
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.7em;
    font-weight: bold;
}

.tag-number {
    font-size: 1.3em;
    font-weight: bold;
    letter-spacing: 2px;
}

.tag-delete {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 1.5em;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.tag-delete:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

/* Empty State */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: #999;
}

.empty-icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-text {
    font-size: 1.3em;
    font-weight: 600;
    margin-bottom: 10px;
    color: #666;
}

.empty-subtext {
    font-size: 0.9em;
    color: #999;
}

/* ========================================
   TOAST NOTIFICATIONS
   ======================================== */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    pointer-events: none;
}

.toast {
    background: white;
    padding: 15px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 250px;
    animation: slideIn 0.3s ease;
    pointer-events: auto;
}

.toast-success {
    border-left: 4px solid #4caf50;
}

.toast-warning {
    border-left: 4px solid #ff9800;
}

.toast-error {
    border-left: 4px solid #f44336;
}

.toast-icon {
    font-size: 1.5em;
    font-weight: bold;
}

.toast-success .toast-icon {
    color: #4caf50;
}

.toast-warning .toast-icon {
    color: #ff9800;
}

.toast-error .toast-icon {
    color: #f44336;
}

.toast-message {
    flex: 1;
    color: #333;
    font-weight: 500;
}

.toast-fade-out {
    animation: fadeOut 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .license-container {
        padding: 30px 20px;
    }

    .app-header {
        flex-direction: column;
        gap: 15px;
    }

    .session-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .session-actions {
        width: 100%;
    }

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

    .manual-input-group {
        flex-direction: column;
    }

    .tag-list {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }

    .confirmation-box {
        min-width: 280px;
        padding: 20px;
    }

    .confirmation-buttons {
        flex-direction: column;
    }

    .confirmation-buttons .btn {
        width: 100%;
    }
}

/* ========================================
   SCROLLBAR STYLING
   ======================================== */

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

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

.tag-list::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.tag-list::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}

/* ========================================
   NEW UI: COUNTRY SELECTOR & LARGE INPUT
   ======================================== */

/* Country Code Selector */
.country-selector {
    margin-bottom: 20px;
}

.country-selector label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.country-selector.hidden {
    display: none;
}

.country-dropdown {
    width: 100%;
    padding: 15px;
    font-size: 1.2em;
    border: 2px solid #667eea;
    border-radius: 10px;
    background: white;
    color: #333;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.country-dropdown:focus {
    outline: none;
    border-color: #5568d3;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* Large Manual Input */
.manual-input-large {
    flex: 1;
    padding: 20px;
    font-size: 1.8em;
    font-weight: bold;
    border: 3px solid #667eea;
    border-radius: 12px;
    text-align: center;
    letter-spacing: 3px;
    transition: all 0.3s ease;
}

.manual-input-large:focus {
    outline: none;
    border-color: #5568d3;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2);
    transform: scale(1.02);
}

.manual-input-large::placeholder {
    font-size: 0.5em;
    font-weight: normal;
    letter-spacing: normal;
}

/* Large Primary Button */
.btn-primary-large {
    padding: 20px 30px;
    font-size: 1.3em;
    font-weight: bold;
    min-width: 150px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .manual-input-large {
        font-size: 1.5em;
        padding: 18px;
    }
    
    .btn-primary-large {
        font-size: 1.1em;
        padding: 18px 25px;
    }
    
    .country-dropdown {
        font-size: 1.1em;
    }
}
.voice-language-selector {
    margin-bottom: 20px;
    text-align: center;
}

.voice-language-selector label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}

.voice-language-dropdown {
    padding: 10px 20px;
    font-size: 1.1em;
    border: 2px solid #667eea;
    border-radius: 8px;
    cursor: pointer;
}

/* ========================================
   SESSION SELECTION SCREEN
   ======================================== */

.session-container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    margin: 0 auto;
}

.session-header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    color: #667eea;
    text-align: center;
}

.session-header p {
    color: #666;
    font-size: 1.1em;
    margin-bottom: 40px;
    text-align: center;
}

.session-form {
    max-width: 500px;
    margin: 0 auto;
}

.session-form h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.2em;
}

/* Species Selection */
.species-selection {
    margin-bottom: 30px;
}

.species-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.species-btn {
    background: white;
    border: 3px solid #ddd;
    border-radius: 15px;
    padding: 30px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.species-btn:hover {
    border-color: #667eea;
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.2);
}

.species-btn.active {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.species-icon {
    font-size: 3em;
}

.species-name {
    font-size: 1.3em;
    font-weight: bold;
}

.species-label {
    font-size: 0.9em;
    opacity: 0.8;
}

/* Category Section */
.category-section {
    margin-bottom: 25px;
}

.category-section.hidden {
    display: none;
}

.category-dropdown {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
    border: 2px solid #ddd;
    border-radius: 10px;
    background: white;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-dropdown:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Location Section */
.location-section {
    margin-bottom: 25px;
}

.location-section.hidden {
    display: none;
}

.location-dropdown {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
    border: 2px solid #ddd;
    border-radius: 10px;
    background: white;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 15px;
}

.location-dropdown:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.custom-location-input {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
    border: 2px solid #667eea;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.custom-location-input:focus {
    outline: none;
    border-color: #5568d3;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.custom-location-input.hidden {
    display: none;
}

/* Start Tagging Button */
.btn-large {
    width: 100%;
    padding: 18px;
    font-size: 1.3em;
    margin-top: 10px;
}

.btn-large.hidden {
    display: none;
}

/* Session Summary */
.session-summary {
    margin-top: 25px;
    padding: 20px;
    background: #e8f5e9;
    border-left: 4px solid #4caf50;
    border-radius: 10px;
    display: flex;
    gap: 15px;
    align-items: center;
}

.session-summary.hidden {
    display: none;
}

.summary-icon {
    font-size: 2.5em;
}

.summary-text {
    flex: 1;
    color: #2e7d32;
    line-height: 1.6;
}

.summary-text strong {
    font-size: 1.1em;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .session-container {
        padding: 30px 20px;
    }

    .species-buttons {
        grid-template-columns: 1fr;
    }

    .species-btn {
        padding: 25px 15px;
    }
}
