/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', 'Tajawal', sans-serif;
    line-height: 1.6;
    color: #1a1a2e;
    background: linear-gradient(135deg, #0f0f23 0%, #16213e 25%, #1a1a2e 50%, #0f0f23 75%, #16213e 100%);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Matrix Background Effect */
.matrix-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.1;
    background: 
        radial-gradient(circle at 20% 30%, rgba(0, 212, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 0, 150, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(0, 255, 100, 0.05) 0%, transparent 50%);
    animation: matrixPulse 4s ease-in-out infinite;
}

@keyframes matrixPulse {
    0%, 100% { opacity: 0.1; }
    50% { opacity: 0.2; }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.header {
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 2px solid rgba(0, 212, 255, 0.3);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 4px 30px rgba(0, 212, 255, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo-icon {
    font-size: 3rem;
    background: linear-gradient(135deg, #00d4ff, #ff0096);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: logoGlow 2s ease-in-out infinite alternate;
}

@keyframes logoGlow {
    0% { filter: drop-shadow(0 0 5px rgba(0, 212, 255, 0.5)); }
    100% { filter: drop-shadow(0 0 20px rgba(0, 212, 255, 0.8)); }
}

.logo-text h1 {
    font-size: 1.8rem;
    font-weight: 900;
    color: #00d4ff;
    margin-bottom: 0.2rem;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.logo-text p {
    font-size: 0.9rem;
    color: #a0a0a0;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.control-btn {
    background: linear-gradient(135deg, #00d4ff, #0099cc);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.3);
}

.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 212, 255, 0.4);
}

.control-btn.active {
    background: linear-gradient(135deg, #ff0096, #cc0077);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #00ff64;
    font-weight: 600;
    font-size: 0.9rem;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #00ff64;
    animation: pulse 2s infinite;
    box-shadow: 0 0 10px rgba(0, 255, 100, 0.5);
}

.status-dot.active {
    background: #00ff64;
}

@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
    100% { opacity: 1; transform: scale(1); }
}

/* Main Dashboard */
.main-dashboard {
    padding: 2rem 0;
}

.section-title {
    font-size: 2rem;
    font-weight: 700;
    color: #00d4ff;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.section-title i {
    font-size: 1.5rem;
    background: linear-gradient(135deg, #00d4ff, #ff0096);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Metrics Section */
.metrics-section {
    margin-bottom: 3rem;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.metric-card {
    background: rgba(26, 26, 46, 0.8);
    border-radius: 20px;
    padding: 1.5rem;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 212, 255, 0.2);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #00d4ff, #ff0096);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-5px);
    border-color: rgba(0, 212, 255, 0.5);
    box-shadow: 0 10px 40px rgba(0, 212, 255, 0.2);
}

.metric-card:hover::before {
    opacity: 1;
}

.metric-card.primary {
    border-color: rgba(0, 212, 255, 0.3);
}

.metric-card.secondary {
    border-color: rgba(0, 255, 100, 0.3);
}

.metric-card.tertiary {
    border-color: rgba(255, 150, 0, 0.3);
}

.metric-card.quaternary {
    border-color: rgba(255, 0, 150, 0.3);
}

.metric-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.metric-icon {
    font-size: 2rem;
    background: linear-gradient(135deg, #00d4ff, #ff0096);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.metric-header h3 {
    color: #ffffff;
    font-size: 1.1rem;
    font-weight: 600;
}

.metric-value {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.metric-value .value {
    font-size: 2.5rem;
    font-weight: 900;
    color: #00d4ff;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
}

.metric-value .unit {
    font-size: 1rem;
    color: #a0a0a0;
}

.metric-trend {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.metric-trend.positive {
    color: #00ff64;
}

.metric-trend.negative {
    color: #ff4757;
}

.metric-trend.neutral {
    color: #ffa502;
}

.metric-chart {
    height: 60px;
    position: relative;
}

.metric-chart canvas {
    width: 100% !important;
    height: 100% !important;
}

/* P&ID Section */
.pid-section {
    margin-bottom: 3rem;
}

.pid-container {
    background: rgba(26, 26, 46, 0.8);
    border-radius: 20px;
    padding: 2rem;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 212, 255, 0.2);
}

.pid-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.pid-btn {
    background: rgba(0, 212, 255, 0.1);
    color: #00d4ff;
    border: 1px solid rgba(0, 212, 255, 0.3);
    padding: 0.8rem 1.5rem;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.pid-btn:hover, .pid-btn.active {
    background: rgba(0, 212, 255, 0.2);
    border-color: #00d4ff;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.2);
}

.pid-diagram {
    position: relative;
    min-height: 400px;
    background: 
        radial-gradient(circle at 20% 20%, rgba(0, 212, 255, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 0, 150, 0.05) 0%, transparent 50%);
    border-radius: 15px;
    padding: 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    align-items: start;
}

.pid-element {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(0, 212, 255, 0.3);
    border-radius: 15px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    backdrop-filter: blur(10px);
}

.pid-element:hover {
    transform: scale(1.05);
    border-color: #00d4ff;
    box-shadow: 0 8px 30px rgba(0, 212, 255, 0.3);
}

.pid-element.active {
    border-color: #00ff64;
    background: rgba(0, 255, 100, 0.1);
}

.pid-element .element-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #00d4ff, #ff0096);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.pid-element .element-label {
    color: #ffffff;
    font-weight: 600;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.element-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.status-light {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff4757;
}

.status-light.active {
    background: #00ff64;
    animation: pulse 2s infinite;
}

.status-light.warning {
    background: #ffa502;
    animation: pulse 2s infinite;
}

.status-text {
    color: #a0a0a0;
    font-size: 0.8rem;
}

.element-data {
    color: #00d4ff;
    font-weight: 700;
    font-size: 1.1rem;
}

.pid-connections {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.flow-line {
    stroke-dasharray: 10, 5;
    animation: flowAnimation 2s linear infinite;
}

.flow-line.active {
    stroke: #00d4ff;
    filter: drop-shadow(0 0 5px rgba(0, 212, 255, 0.5));
}

@keyframes flowAnimation {
    0% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: 15; }
}

/* Analytics Section */
.analytics-section {
    margin-bottom: 3rem;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.analytics-card {
    background: rgba(26, 26, 46, 0.8);
    border-radius: 20px;
    padding: 2rem;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 212, 255, 0.2);
    transition: all 0.3s ease;
}

.analytics-card:hover {
    border-color: rgba(0, 212, 255, 0.5);
    box-shadow: 0 10px 40px rgba(0, 212, 255, 0.2);
}

.analytics-card h3 {
    color: #ffffff;
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-align: center;
}

.chart-container {
    height: 200px;
    margin-bottom: 1.5rem;
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

.analytics-insights {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.insight {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(0, 212, 255, 0.1);
    border-radius: 10px;
    border-left: 3px solid #00d4ff;
}

.insight i {
    color: #00d4ff;
    font-size: 1.2rem;
}

.insight span {
    color: #ffffff;
    font-size: 0.9rem;
}

/* Quality Metrics */
.quality-metrics {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.quality-item {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.quality-label {
    color: #ffffff;
    font-weight: 600;
    min-width: 120px;
}

.quality-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.quality-fill {
    height: 100%;
    background: linear-gradient(90deg, #00d4ff, #00ff64);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.quality-value {
    color: #00d4ff;
    font-weight: 700;
    min-width: 50px;
    text-align: right;
}

/* Cost Analysis */
.cost-analysis {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.cost-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(0, 212, 255, 0.05);
    border-radius: 10px;
}

.cost-icon {
    font-size: 2rem;
    background: linear-gradient(135deg, #00d4ff, #ff0096);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.cost-data {
    flex: 1;
}

.cost-label {
    color: #a0a0a0;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.cost-value {
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.cost-trend {
    font-size: 0.9rem;
    font-weight: 600;
}

.cost-trend.positive {
    color: #00ff64;
}

.cost-trend.negative {
    color: #ff4757;
}

/* Timeline Section */
.timeline-section {
    margin-bottom: 3rem;
}

.timeline-container {
    background: rgba(26, 26, 46, 0.8);
    border-radius: 20px;
    padding: 2rem;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 212, 255, 0.2);
}

.timeline-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.timeline-btn {
    background: rgba(0, 212, 255, 0.1);
    color: #00d4ff;
    border: 1px solid rgba(0, 212, 255, 0.3);
    padding: 0.8rem 1.5rem;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
}

.timeline-btn:hover, .timeline-btn.active {
    background: rgba(0, 212, 255, 0.2);
    border-color: #00d4ff;
    box-shadow: 0 4px 15px rgba(0, 212, 255, 0.2);
}

.timeline-chart {
    height: 300px;
    margin-bottom: 2rem;
}

.timeline-chart canvas {
    width: 100% !important;
    height: 100% !important;
}

.timeline-milestones {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.milestone {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.milestone.completed {
    background: rgba(0, 255, 100, 0.1);
    border-left: 3px solid #00ff64;
}

.milestone.in-progress {
    background: rgba(0, 212, 255, 0.1);
    border-left: 3px solid #00d4ff;
}

.milestone.upcoming {
    background: rgba(255, 150, 0, 0.1);
    border-left: 3px solid #ffa502;
}

.milestone-icon {
    font-size: 1.5rem;
}

.milestone-info h4 {
    color: #ffffff;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.milestone-info p {
    color: #a0a0a0;
    font-size: 0.9rem;
}

/* Resources Section */
.resources-section {
    margin-bottom: 3rem;
}

.resources-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.resource-card {
    background: rgba(26, 26, 46, 0.8);
    border-radius: 20px;
    padding: 2rem;
    text-align: center;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 212, 255, 0.2);
    transition: all 0.3s ease;
}

.resource-card:hover {
    transform: translateY(-5px);
    border-color: rgba(0, 212, 255, 0.5);
    box-shadow: 0 10px 40px rgba(0, 212, 255, 0.2);
}

.resource-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #00d4ff, #ff0096);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.resource-card h3 {
    color: #ffffff;
    font-weight: 600;
    margin-bottom: 1rem;
}

.resource-card p {
    color: #a0a0a0;
    margin-bottom: 1.5rem;
}

.download-btn {
    background: linear-gradient(135deg, #00d4ff, #0099cc);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.download-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 212, 255, 0.4);
}

/* Footer */
.footer {
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(20px);
    border-top: 2px solid rgba(0, 212, 255, 0.3);
    padding: 2rem 0;
    margin-top: 3rem;
}

.contact-info {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #00d4ff;
    font-weight: 600;
}

.contact-item i {
    font-size: 1.2rem;
}

.footer-text {
    text-align: center;
    color: #a0a0a0;
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .analytics-grid {
        grid-template-columns: 1fr;
    }
    
    .pid-diagram {
        grid-template-columns: 1fr;
    }
    
    .timeline-milestones {
        grid-template-columns: 1fr;
    }
    
    .resources-grid {
        grid-template-columns: 1fr;
    }
    
    .contact-info {
        flex-direction: column;
        align-items: center;
    }
    
    .section-title {
        font-size: 1.5rem;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    .logo-text h1 {
        font-size: 1.4rem;
    }
    
    .metric-value .value {
        font-size: 2rem;
    }
    
    .pid-controls, .timeline-controls {
        flex-direction: column;
    }
    
    .pid-btn, .timeline-btn {
        width: 100%;
    }
}

/* Animation Classes */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

.slide-in-left {
    opacity: 0;
    transform: translateX(-50px);
    transition: all 0.6s ease;
}

.slide-in-left.visible {
    opacity: 1;
    transform: translateX(0);
}

.slide-in-right {
    opacity: 0;
    transform: translateX(50px);
    transition: all 0.6s ease;
}

.slide-in-right.visible {
    opacity: 1;
    transform: translateX(0);
}

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

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

/* Glow Effects */
.glow {
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        box-shadow: 0 0 5px rgba(0, 212, 255, 0.2);
    }
    to {
        box-shadow: 0 0 20px rgba(0, 212, 255, 0.6);
    }
}

