/* Custom CSS for Greenhouse Guardian */
/* RTL Support and Arabic Typography */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700&display=swap');

:root {
    --primary-50: #ecfdf5;
    --primary-100: #d1fae5;
    --primary-500: #10b981;
    --primary-600: #059669;
    --primary-700: #047857;
    --secondary-500: #f59e0b;
    --earth-50: #fafaf9;
    --earth-100: #f5f5f4;
    --earth-200: #e7e5e4;
    --earth-800: #292524;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* RTL Specific Styles */
[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] .space-x-2 > * + * {
    --tw-space-x-reverse: 1;
}

[dir="rtl"] .space-x-4 > * + * {
    --tw-space-x-reverse: 1;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--earth-100);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--earth-200);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-500);
}

/* Animations */
@keyframes pulse-slow {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse-slow {
    animation: pulse-slow 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* Glass Effect */
.glass {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Sensor Card Hover Effect */
.sensor-card {
    transition: all 0.3s ease;
}

.sensor-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.1);
}

/* Progress Ring */
.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring__circle {
    transition: stroke-dashoffset 0.35s;
    transform-origin: 50% 50%;
}

/* Toggle Switch */
.toggle-checkbox:checked {
    right: 0;
    border-color: var(--primary-500);
}

.toggle-checkbox:checked + .toggle-label {
    background-color: var(--primary-500);
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 100%;
    width: 100%;
}

/* Alert Badge Animation */
.alert-badge {
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Soil Moisture Bar Animation */
.soil-bar {
    transition: width 0.5s ease;
}

/* Irrigation Button Pulse */
.irrigation-pulse {
    animation: irrigation-pulse 2s infinite;
}

@keyframes irrigation-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Stage Timeline */
.stage-timeline {
    position: relative;
}

.stage-timeline::before {
    content: '';
    position: absolute;
    right: 20px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--earth-200);
}

.stage-timeline__item {
    position: relative;
    padding-right: 50px;
}

.stage-timeline__item::before {
    content: '';
    position: absolute;
    right: 11px;
    top: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: white;
    border: 2px solid var(--earth-200);
}

.stage-timeline__item--active::before {
    background: var(--primary-500);
    border-color: var(--primary-500);
}

.stage-timeline__item--completed::before {
    background: var(--primary-500);
    border-color: var(--primary-500);
}

.stage-timeline__item--completed::after {
    content: '✓';
    position: absolute;
    right: 16px;
    top: 4px;
    font-size: 12px;
    color: white;
}

/* Weather Widget */
.weather-widget {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* Responsive Typography */
@media (max-width: 640px) {
    html {
        font-size: 14px;
    }
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .print-only {
        display: block !important;
    }
}

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(90deg, var(--earth-100) 25%, var(--earth-200) 50%, var(--earth-100) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Custom Tooltip */
.custom-tooltip {
    position: relative;
}

.custom-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: var(--earth-800);
    color: white;
    font-size: 12px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.custom-tooltip:hover::after {
    opacity: 1;
    visibility: visible;
    bottom: calc(100% + 8px);
}

/* Focus Styles */
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* Selection Color */
::selection {
    background: var(--primary-200);
    color: var(--primary-900);
}