/* Modern Signal Analysis Tool Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body { 
    background-color: #0d1117; 
    color: #e6edf3; 
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    direction: rtl; 
    padding: 20px; 
    margin: 0;
    line-height: 1.6;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="50" cy="50" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    pointer-events: none;
    z-index: -1;
}

.container { 
    max-width: 1200px; 
    margin: auto; 
    background: #161b22; 
    border-radius: 12px; 
    padding: 30px; 
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    border: 1px solid #30363d;
}

.container::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #3498db, #e74c3c, #f39c12, #27ae60);
    border-radius: 22px;
    z-index: -1;
    opacity: 0.3;
    animation: borderGlow 3s ease-in-out infinite alternate;
}

@keyframes borderGlow {
    0% { opacity: 0.3; }
    100% { opacity: 0.6; }
}

h2 { 
    border-bottom: 2px solid #30363d; 
    padding-bottom: 15px; 
    margin-bottom: 25px; 
    color: #58a6ff; 
    font-size: 1.8em;
    font-weight: 600;
}

table { 
    width: 100%; 
    border-collapse: collapse; 
    margin-top: 25px; 
    border-radius: 10px; 
    overflow: hidden;
    background: #0d1117;
    border: 1px solid #30363d;
}

th, td { 
    padding: 15px 12px; 
    border: 1px solid #30363d; 
    text-align: center; 
    vertical-align: middle;
}

th { 
    background-color: #21262d; 
    color: #c9d1d9; 
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9em;
    letter-spacing: 0.5px;
}

tr:nth-child(even) { 
    background-color: #1c2128; 
}

tr:hover { 
    background-color: #2a2f38; 
    transition: background-color 0.2s ease;
}

input[type="text"], 
input[type="password"] { 
    width: 100%; 
    padding: 12px 15px; 
    margin-bottom: 15px; 
    background: #0d1117; 
    border: 2px solid #30363d; 
    color: #c9d1d9; 
    border-radius: 8px; 
    outline: none; 
    transition: all 0.3s ease;
    font-size: 14px;
    box-sizing: border-box;
}

input[type="text"]:focus, 
input[type="password"]:focus { 
    border-color: #58a6ff; 
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.1);
}

input[type="submit"] { 
    background: linear-gradient(135deg, #238636 0%, #2ea043 100%);
    color: white; 
    padding: 12px 24px; 
    width: 100%; 
    border: none; 
    border-radius: 8px; 
    cursor: pointer; 
    transition: all 0.3s ease;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 55px 0 0 0;
}

input[type="submit"]:hover { 
    background: linear-gradient(135deg, #2ea043 0%, #3fb950 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46, 160, 67, 0.3);
    margin: 55px 0 0 0;
}

.success { 
    color: #3fb950; 
    margin-top: 15px; 
    padding: 12px 16px;
    background: rgba(63, 185, 80, 0.1);
    border: 1px solid rgba(63, 185, 80, 0.3);
    border-radius: 8px;
    font-weight: 500;
}

.error { 
    color: #f85149; 
    margin-top: 15px; 
    padding: 12px 16px;
    background: rgba(248, 81, 73, 0.1);
    border: 1px solid rgba(248, 81, 73, 0.3);
    border-radius: 8px;
    font-weight: 500;
}

.limit { 
    margin-top: 15px; 
    font-size: 16px; 
    color: #ffa657; 
    background: #21262d; 
    padding: 12px 16px; 
    border-radius: 8px;
    border: 1px solid #30363d;
    display: flex;
    align-items: center;
    gap: 8px;
}

a { 
    color: #58a6ff; 
    text-decoration: none; 
    transition: color 0.3s ease;
}

a:hover { 
    color: #79c0ff;
    text-decoration: underline; 
}

.dev-link {
    background: linear-gradient(135deg, #f0f6fc 0%, #e6edf3 100%);
    color: #0d1117 !important;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none !important;
    transition: all 0.3s ease;
    border: 1px solid #30363d;
}

.dev-link:hover {
    background: linear-gradient(135deg, #e6edf3 0%, #d0d7de 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.logout-btn {
    background: linear-gradient(135deg, #f85149 0%, #da3633 100%) !important;
    color: white !important;
    padding: 8px 16px !important;
    width: auto !important;
    border-radius: 6px;
    font-size: 14px !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}

.logout-btn:hover {
    background: linear-gradient(135deg, #da3633 0%, #f85149 100%) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(248, 81, 73, 0.3);
}

.delete-btn {
    background: linear-gradient(135deg, #f85149 0%, #da3633 100%) !important;
    color: white !important;
    padding: 6px 12px !important;
    width: auto !important;
    border-radius: 4px;
    font-size: 12px !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}

.delete-btn:hover {
    background: linear-gradient(135deg, #da3633 0%, #f85149 100%) !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(248, 81, 73, 0.3);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 25px 0;
}

.stat-card {
    background: linear-gradient(135deg, #21262d 0%, #1c2128 100%);
    padding: 25px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid #30363d;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #58a6ff, #79c0ff);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
    border-color: #58a6ff;
}

.stat-number {
    font-size: 2.5em;
    color: #58a6ff;
    font-weight: bold;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(88, 166, 255, 0.3);
}

.stat-label {
    color: #8b949e;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Header Actions */
.header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

/* Machine ID Input */
.machine-id-input {
    position: relative;
    margin-bottom: 10px;
    margin: 55px 0 0 0;
}

.input-hint {
    font-size: 13px;
    color: #8b949e;
    margin-top: 8px;
    padding: 8px 12px;
    background: rgba(139, 148, 158, 0.1);
    border-radius: 6px;
    border-left: 3px solid #58a6ff;
}

/* Table Container */
.table-container {
    overflow-x: auto;
    border-radius: 10px;
    border: 1px solid #30363d;
}

/* Code styling for Machine IDs */
code {
    background: #0d1117;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #79c0ff;
    border: 1px solid #30363d;
    font-size: 0.9em;
}

.header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.header h1 {
    color: #2c3e50;
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 300;
}

.header p {
    color: #7f8c8d;
    font-size: 1.1em;
}

.input-section {
    display: flex;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.textarea-container {
    flex: 1;
    min-width: 300px;
}

textarea {
    width: 100%;
    min-height: 100px;
    padding: 20px;
    border: 2px solid #e0e0e0;
    border-radius: 15px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    line-height: 1.5;
    background: #fafafa;
    color: #2c3e50;
    resize: vertical;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    background: #fff;
}

.settings-toggle {
    margin-bottom: 15px;
    text-align: center;
}

.settings-toggle .btn {
    background: linear-gradient(45deg, #95a5a6, #7f8c8d);
    border: 2px solid #7f8c8d;
    transition: all 0.3s ease;
}

.settings-toggle .btn:hover {
    background: linear-gradient(45deg, #7f8c8d, #95a5a6);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(149, 165, 166, 0.4);
}

.controls {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 15px;
    min-width: 250px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    border: 2px solid #e0e0e0;
    margin-top: 15px;
}

.controls h4 {
    color: #2c3e50;
    font-size: 1.2em;
    margin-bottom: 20px;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.settings-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.settings-actions .btn {
    padding: 8px 16px;
    font-size: 14px;
    margin: 0;
}

.control-group {
    margin-bottom: 15px;
}

.control-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.9em;
}

.control-group input,
.control-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    transition: all 0.3s ease;
}

.control-group input:focus,
.control-group select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.1);
}

.buttons {
    text-align: center;
    margin: 30px 0;
    position: relative;
}

.buttons::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #3498db, transparent);
    transform: translateY(-50%);
}

.btn {
    padding: 12px 30px;
    margin: 0 10px;
    border: none;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    z-index: 1;
}

.btn-primary {
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    position: relative;
    overflow: hidden;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
    z-index: -1;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.btn-secondary {
    background: linear-gradient(45deg, #95a5a6, #7f8c8d);
    color: white;
    box-shadow: 0 4px 15px rgba(149, 165, 166, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(149, 165, 166, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.results {
    margin-top: 30px;
    position: relative;
}

sult-item {
    background: #fff;
    border-radius: 15px;
    padding: 20px;


    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.result-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(45deg, #3498db, #2980b9);
    border-radius: 2px;
}

.result-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.result-item:hover::before {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
}

.canvas-container {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

canvas {
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    background: #fff;
}

.result-number {
    background: linear-gradient(45deg, #3498db, #2980b9);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(52, 152, 219, 0.3);
    transition: all 0.3s ease;
}

.result-number:hover {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.4);
}

.script-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: #666;
    margin-top: 10px;
    max-height: 200px;
    overflow-y: auto;
    border-left: 4px solid #3498db;
}

.documentation {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid #e0e0e0;
    position: relative;
}

.documentation::before {
    content: '📚 الدليل والمساعدة';
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    padding: 0 20px;
    font-weight: bold;
    color: #2c3e50;
    font-size: 1.2em;
}

.doc-section {
    margin-bottom: 30px;
}

.doc-section h3 {
    color: #2c3e50;
    font-size: 1.5em;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #3498db;
    display: inline-block;
    position: relative;
}

.doc-section h3::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: #e74c3c;
    transition: width 0.3s ease;
}

.doc-section:hover h3::after {
    width: 100%;
}

.doc-content {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    font-family: 'Courier New', monospace;
    line-height: 1.8;
    color: #2c3e50;
    border-left: 4px solid #e74c3c;
}

.footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    color: #7f8c8d;
    font-size: 0.9em;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .container {
        padding: 25px;
        margin: 15px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .stat-number {
        font-size: 2em;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 20px;
        margin: 10px;
        border-radius: 8px;
    }
    
    h2 {
        font-size: 1.5em;
        margin-bottom: 20px;
    }
    
    .header-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-number {
        font-size: 1.8em;
    }
    
    table {
        font-size: 13px;
    }
    
    th, td {
        padding: 10px 8px;
    }
    
    input[type="text"], 
    input[type="password"] {
        padding: 10px 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    input[type="submit"] {
        padding: 12px 20px;
        font-size: 16px;
        margin: 55px 0 0 0;
    }
    
    .limit {
        font-size: 14px;
        padding: 10px 12px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 1.5em;
    }
    
    .header p {
        font-size: 1em;
    }
    
    textarea {
        font-size: 14px;
        padding: 15px;
    }
    
    .control-group label {
        font-size: 0.8em;
    }
    
    .control-group input,
    .control-group select {
        font-size: 12px;
        padding: 8px 10px;
    }
}

/* Animation for loading */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-item {
    animation: fadeIn 0.5s ease-out;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
} 

/* Loading animation */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.loading {
    animation: pulse 1.5s infinite;
}

/* Smooth transitions */
* {
    transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

/* Focus styles for accessibility */
input:focus,
button:focus,
a:focus {
    outline: 2px solid #58a6ff;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .header-actions,
    .stats-grid,
    form {
        display: none;
    }
    
    table {
        border: 1px solid #000;
    }
    
    th, td {
        border: 1px solid #000;
        color: #000;
    }
} 