/* إعداد عام */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c5aa0;
    --secondary-color: #4CAF50;
    --accent-color: #FF9800;
    --danger-color: #f44336;
    --warning-color: #ff9800;
    --success-color: #4caf50;
    --dark-color: #333;
    --light-color: #f5f5f5;
    --white: #ffffff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --border-radius: 8px;
    --font-family: 'Cairo', Arial, sans-serif;
}

body {
    font-family: var(--font-family);
    direction: rtl;
    text-align: right;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    line-height: 1.6;
}

/* صفحة تسجيل الدخول */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 40px;
    text-align: center;
}

.login-header h1 {
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 10px;
    font-weight: 700;
}

.login-header p {
    color: #666;
    margin-bottom: 30px;
    font-size: 1.1rem;
}

/* النماذج */
.form-group {
    margin-bottom: 20px;
    text-align: right;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--dark-color);
    font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: var(--font-family);
    transition: border-color 0.3s ease;
    direction: rtl;
    text-align: right;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* الأزرار */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-family);
}

.btn-primary {
    background: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background: #1e3d72;
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success-color);
    color: var(--white);
}

.btn-success:hover {
    background: #45a049;
}

.btn-danger {
    background: var(--danger-color);
    color: var(--white);
}

.btn-danger:hover {
    background: #da190b;
}

.btn-warning {
    background: var(--warning-color);
    color: var(--white);
}

.btn-warning:hover {
    background: #e68900;
}

.btn-full {
    width: 100%;
}

/* التنبيهات */
.alert {
    padding: 15px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    text-align: right;
}

.alert-error {
    background: #ffebee;
    color: var(--danger-color);
    border: 1px solid #ffcdd2;
}

.alert-success {
    background: #e8f5e8;
    color: var(--success-color);
    border: 1px solid #c8e6c9;
}

.alert-info {
    background: #e3f2fd;
    color: var(--primary-color);
    border: 1px solid #bbdefb;
}

/* لوحة التحكم */
.dashboard-container {
    min-height: 100vh;
    background: var(--light-color);
}

.dashboard-header {
    background: var(--primary-color);
    color: var(--white);
    padding: 1rem 2rem;
    box-shadow: var(--shadow);
}

.dashboard-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
}

.dashboard-logo {
    font-size: 1.5rem;
    font-weight: 700;
}

.dashboard-user {
    display: flex;
    align-items: center;
    gap: 15px;
}

.dashboard-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.dashboard-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    text-align: center;
    transition: transform 0.3s ease;
}

.dashboard-card:hover {
    transform: translateY(-5px);
}

.dashboard-card h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

.dashboard-card p {
    color: #666;
    margin-bottom: 1.5rem;
}

.dashboard-card .btn {
    width: 100%;
}

/* الجداول */
.table-container {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-top: 2rem;
}

.table-header {
    background: var(--primary-color);
    color: var(--white);
    padding: 1rem 1.5rem;
}

.table-header h2 {
    margin: 0;
}

.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table th,
.data-table td {
    padding: 12px 15px;
    text-align: right;
    border-bottom: 1px solid #eee;
}

.data-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: var(--dark-color);
}

.data-table tr:hover {
    background: #f8f9fa;
}

.data-table .actions {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.data-table .btn {
    padding: 5px 10px;
    font-size: 0.8rem;
    margin: 0;
}

/* النماذج المعقدة */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.form-section {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 2rem;
    margin-bottom: 2rem;
}

.form-section h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e0e0e0;
}

/* شريط المهارات */
.skill-bar {
    margin-bottom: 1rem;
}

.skill-bar label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.skill-input-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.skill-input-group input[type="range"] {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: #e0e0e0;
    outline: none;
}

.skill-input-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
}

.skill-value {
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    color: var(--primary-color);
}

/* تصميم الفريق */
.teams-layout {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    border-radius: var(--border-radius);
    padding: 2rem;
    margin-top: 2rem;
    position: relative;
}

.teams-layout::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grass" x="0" y="0" width="10" height="10" patternUnits="userSpaceOnUse"><rect width="10" height="10" fill="%234CAF50"/><path d="M0 5 Q2.5 2.5 5 5 T10 5" stroke="%2345a049" fill="none" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grass)"/></svg>');
    opacity: 0.1;
    border-radius: var(--border-radius);
}

.teams-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    position: relative;
    z-index: 1;
}

.team-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.team-card h4 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.team-rating {
    background: var(--accent-color);
    color: var(--white);
    padding: 5px 10px;
    border-radius: 20px;
    font-weight: 600;
    margin-bottom: 1rem;
    display: inline-block;
}

.team-count {
    color: #666;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.team-players {
    text-align: right;
    min-height: 150px;
    background: rgba(248, 249, 250, 0.8);
    border-radius: 8px;
    padding: 10px;
    border: 2px dashed transparent;
    transition: all 0.3s ease;
}

.team-player {
    background: #f8f9fa;
    padding: 8px 12px;
    margin-bottom: 5px;
    border-radius: var(--border-radius);
    border-right: 4px solid var(--primary-color);
    cursor: move;
    transition: all 0.3s ease;
}

.team-player:hover {
    transform: translateX(-5px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.player-position {
    font-size: 0.8rem;
    color: #666;
}

.player-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.player-name {
    font-weight: 600;
}

.player-rating {
    background: var(--success-color);
    color: white;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

/* أزرار الإجراءات */
.actions-bar {
    background: var(--white);
    padding: 1rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.actions-bar .btn {
    margin: 0;
}

/* المودال */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: var(--white);
    margin: 5% auto;
    padding: 2rem;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 500px;
    position: relative;
}

.modal-header {
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    color: var(--primary-color);
    margin: 0;
}

.close {
    position: absolute;
    left: 1rem;
    top: 1rem;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    color: #666;
}

.close:hover {
    color: var(--dark-color);
}

/* المعلومات التوضيحية */
.demo-info {
    background: #e3f2fd;
    padding: 15px;
    border-radius: var(--border-radius);
    text-align: center;
    color: var(--primary-color);
    border: 1px solid #bbdefb;
    margin-top: 2rem;
}

/* أنماط السحب والإفلات */
.draggable {
    cursor: move;
    transition: all 0.3s ease;
}

.draggable:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.dragging {
    opacity: 0.6;
    transform: rotate(5deg);
    z-index: 1000;
}

.dropzone {
    min-height: 100px;
    transition: all 0.3s ease;
}

.drag-over {
    background-color: rgba(76, 175, 80, 0.1) !important;
    border: 2px dashed #4CAF50;
    transform: scale(1.02);
}

/* رسائل التنبيه للسحب والإفلات */
.message-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    z-index: 10000;
    animation: slideIn 0.3s ease;
}

.message-success {
    background: #4CAF50;
}

.message-error {
    background: #f44336;
}

.message-info {
    background: #2196f3;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* أزرار التغييرات */
.changes-actions {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-top: 1rem;
    text-align: center;
    display: none;
}

.changes-actions.show {
    display: block;
}

.changes-actions .btn {
    margin: 0 10px;
}

/* تصميم محسن للاعبين القابلين للسحب */
.team-player[draggable="true"] {
    cursor: grab;
    position: relative;
}

.team-player[draggable="true"]:active {
    cursor: grabbing;
}

.team-player[draggable="true"]::before {
    content: "⋮⋮";
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
    font-size: 16px;
    font-weight: bold;
}

/* أنماط الحراس */
.skill-fill.goalkeeper {
    background: linear-gradient(90deg, #FF9800, #e68900);
}

/* الاستجابة للشاشات الصغيرة */
@media (max-width: 768px) {
    .dashboard-nav {
        flex-direction: column;
        gap: 1rem;
    }
    
    .dashboard-main {
        padding: 1rem;
    }
    
    .dashboard-cards {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .actions-bar {
        flex-direction: column;
    }
    
    .teams-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
        padding: 1rem;
    }
    
    .data-table {
        font-size: 0.8rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 10px;
    }
    
    .dragging {
        transform: rotate(2deg) scale(1.05);
    }
    
    .message-toast {
        right: 10px;
        left: 10px;
        top: 10px;
    }
    
    .dropzone {
        min-height: 80px;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 20px;
    }
    
    .form-section {
        padding: 1rem;
    }
    
    .team-card {
        padding: 1rem;
    }
}

/* تحسينات إضافية */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}