/**
 * ═══════════════════════════════════════════════════════════════════
 *  نظام إدارة المشاريع - ملف الأنماط
 *  Project Management System - Stylesheet
 *  Version: 2.0 Secure
 * ═══════════════════════════════════════════════════════════════════
 */

/* ==================== Base Styles ==================== */
* {
    font-family: 'Tajawal', sans-serif;
    box-sizing: border-box;
}

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

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #0f766e, #14b8a6);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #115e59, #0f766e);
}

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

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

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

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(20, 184, 166, 0.3);
    }
    50% {
        box-shadow: 0 0 40px rgba(20, 184, 166, 0.6);
    }
}

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

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

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

/* Animation Classes */
.animate-fade {
    animation: fadeIn 0.5s ease-out;
}

.animate-slide {
    animation: slideIn 0.4s ease-out;
}

.animate-slide-right {
    animation: slideInRight 0.4s ease-out;
}

.animate-pulse-glow {
    animation: pulse-glow 2s infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-bounce {
    animation: bounce 1s ease infinite;
}

/* ==================== Loading Shimmer ==================== */
.shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

/* ==================== Progress Bar Animation ==================== */
.progress-animated {
    background: linear-gradient(90deg, #14b8a6, #2dd4bf, #14b8a6);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* ==================== Card Hover Effects ==================== */
.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* ==================== Sidebar ==================== */
.sidebar {
    background: linear-gradient(180deg, #0f766e 0%, #115e59 100%);
    min-height: 100vh;
}

.sidebar-link {
    transition: all 0.3s ease;
    border-radius: 12px;
    margin: 4px 8px;
    text-decoration: none;
}

.sidebar-link:hover,
.sidebar-link.active {
    background: rgba(255, 255, 255, 0.15);
    transform: translateX(-5px);
}

/* ==================== Stat Cards ==================== */
.stat-card {
    background: linear-gradient(135deg, var(--from-color), var(--to-color));
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: scale(1.02);
}

/* ==================== Modal ==================== */
.modal-backdrop {
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.modal-content {
    animation: fadeIn 0.3s ease-out;
}

/* ==================== Toast Notifications ==================== */
.toast {
    animation: slideIn 0.3s ease-out;
    transition: all 0.3s ease;
}

.toast.hiding {
    opacity: 0;
    transform: translateX(-100%);
}

/* ==================== Table Styles ==================== */
.table-row {
    transition: all 0.2s ease;
}

.table-row:hover {
    background: #f0fdfa;
}

/* ==================== Status Badges ==================== */
.badge-active {
    background: #d1fae5;
    color: #065f46;
}

.badge-completed {
    background: #dbeafe;
    color: #1e40af;
}

.badge-onhold {
    background: #fef3c7;
    color: #92400e;
}

.badge-cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.badge-pending {
    background: #f3f4f6;
    color: #374151;
}

.badge-inprogress {
    background: #e0e7ff;
    color: #3730a3;
}

/* ==================== Priority Colors ==================== */
.priority-high {
    border-right: 4px solid #ef4444;
}

.priority-medium {
    border-right: 4px solid #f59e0b;
}

.priority-low {
    border-right: 4px solid #22c55e;
}

/* ==================== Hidden Class ==================== */
.hidden {
    display: none !important;
}

/* ==================== Page Transitions ==================== */
.page {
    display: none;
    opacity: 0;
}

.page.active {
    display: block;
    opacity: 1;
    animation: fadeIn 0.4s ease-out;
}

/* ==================== Form Styles ==================== */
.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: #14b8a6;
    box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.1);
}

.form-input:invalid:not(:placeholder-shown) {
    border-color: #ef4444;
}

.form-input:valid:not(:placeholder-shown) {
    border-color: #22c55e;
}

/* ==================== Button Styles ==================== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, #0f766e, #14b8a6);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #115e59, #0f766e);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(20, 184, 166, 0.3);
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.btn-secondary:hover:not(:disabled) {
    background: #e5e7eb;
}

.btn-danger {
    background: linear-gradient(135deg, #dc2626, #ef4444);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: linear-gradient(135deg, #b91c1c, #dc2626);
}

/* ==================== Alert Styles ==================== */
.alert {
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-weight: 500;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #f59e0b;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #3b82f6;
}

/* ==================== Line Clamp ==================== */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ==================== Loading Overlay ==================== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e5e7eb;
    border-top-color: #14b8a6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* ==================== Tooltip ==================== */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background: #1f2937;
    color: white;
    font-size: 12px;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
}

/* ==================== Responsive Adjustments ==================== */
@media (max-width: 1024px) {
    .sidebar {
        width: 200px;
    }
    
    main {
        margin-right: 200px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -100%;
        transition: left 0.3s ease;
        z-index: 100;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    main {
        margin-right: 0;
    }
    
    .stat-card {
        padding: 16px;
    }
    
    .stat-card .text-4xl {
        font-size: 28px;
    }
}

/* ==================== Print Styles ==================== */
@media print {
    .sidebar,
    .modal-backdrop,
    .toast,
    button {
        display: none !important;
    }
    
    main {
        margin: 0 !important;
    }
    
    .page {
        display: block !important;
        opacity: 1 !important;
    }
}

/* ==================== Dark Mode Support (Future) ==================== */
@media (prefers-color-scheme: dark) {
    /* Reserved for future dark mode implementation */
}

/* ==================== Security Indicator ==================== */
.secure-indicator {
    position: fixed;
    bottom: 10px;
    right: 10px;
    padding: 4px 8px;
    background: #d1fae5;
    color: #065f46;
    font-size: 10px;
    border-radius: 4px;
    z-index: 1000;
}

/* ==================== Accessibility ==================== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

:focus-visible {
    outline: 2px solid #14b8a6;
    outline-offset: 2px;
}

/* ==================== Selection ==================== */
::selection {
    background: #14b8a6;
    color: white;
}

::-moz-selection {
    background: #14b8a6;
    color: white;
}
