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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
    padding: 0;
    margin: 0;
}

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

/* Header Styles */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #ddd;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    color: #2c3e50;
    font-size: 28px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* Card Styles */
.card {
    background: white;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border: 1px solid #e1e1e1;
}

.card h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 22px;
    font-weight: 600;
}

/* Alert Styles */
.alert {
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    font-weight: 500;
}

.alert-error {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.alert-success {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.alert-warning {
    background-color: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
}

/* Button Styles */
.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    font-family: inherit;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #545b62;
}

.btn-success {
    background-color: #28a745;
    color: white;
}

.btn-success:hover {
    background-color: #1e7e34;
}

.btn-warning {
    background-color: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background-color: #e0a800;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* Form Styles */
.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
}

.form-group {
    flex: 1;
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

.form-group small {
    color: #666;
    font-size: 12px;
    display: block;
    margin-top: 4px;
}

.job-form {
    margin-top: 20px;
}

/* Jobs Grid Layout */
.jobs-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.job-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    padding: 20px;
    background: white;
    transition: all 0.2s ease;
    min-height: 400px;
}

.job-card:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.job-card.inactive {
    background-color: #f8f9fa;
    opacity: 0.7;
}

.job-card.inactive:hover {
    opacity: 0.9;
}

/* Job Information Column */
.job-info-column {
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow: hidden;
}

.job-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
}

.job-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
}

.job-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.job-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-grow: 1;
    overflow-y: auto;
    max-height: 250px;
    padding-right: 5px;
}

.job-details::-webkit-scrollbar {
    width: 4px;
}

.job-details::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.job-details::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.job-details::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.job-detail {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.job-detail:last-child {
    border-bottom: none;
}

.job-detail strong {
    color: #555;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 2px;
}

.url-display {
    background: #f8f9fa;
    padding: 8px 10px;
    border-radius: 5px;
    font-family: monospace;
    font-size: 13px;
    word-break: break-all;
    border: 1px solid #e9ecef;
    line-height: 1.3;
    max-height: 60px;
    overflow-y: auto;
}

.url-display::-webkit-scrollbar {
    width: 3px;
}

.url-display::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.url-display::-webkit-scrollbar-thumb {
    background: #c1c1c1;
}

/* Browser Column */
.browser-column {
    display: flex;
    flex-direction: column;
}

.mini-browser {
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
    background: white;
    height: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.mini-browser-header {
    background: #f8f9fa;
    padding: 10px 12px;
    border-bottom: 1px solid #ddd;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: #555;
    font-size: 13px;
}

.mini-browser-frame {
    width: 100%;
    flex-grow: 1;
    border: none;
    background: white;
    min-height: 300px;
}

.browser-controls {
    display: flex;
    gap: 6px;
}

.browser-btn {
    padding: 4px 8px;
    border: 1px solid #ccc;
    background: white;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.browser-btn:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

/* Status Badges */
.status-badge {
    padding: 3px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 500;
    text-transform: capitalize;
    display: inline-block;
    margin-left: 6px;
}

.status-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-failed {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* System Status */
.system-status {
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 25px;
}

.system-status h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    font-size: 20px;
}

.system-status p {
    margin-bottom: 8px;
    color: #555;
}

.status-online {
    color: #28a745;
    font-weight: bold;
}

.status-offline {
    color: #dc3545;
    font-weight: bold;
}

.auto-execution-notice {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 12px 15px;
    border-radius: 6px;
    margin: 15px 0;
    font-size: 14px;
}

.manual-controls {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 15px 0;
}

/* Timer Styles */
.timer-working { 
    color: #28a745;
    font-weight: 500;
    font-size: 14px;
}
.timer-due { 
    color: #ffc107;
    font-weight: bold;
    font-size: 14px;
}
.timer-running { 
    color: #17a2b8;
    font-weight: bold;
    animation: pulse 1s infinite;
    font-size: 14px;
}
.timer-stuck { 
    color: #dc3545; 
    font-weight: bold;
    animation: blink 1s infinite;
    font-size: 14px;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

/* No Jobs Message */
.no-jobs {
    text-align: center;
    color: #666;
    padding: 40px;
    font-style: italic;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px dashed #dee2e6;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .container {
        max-width: 100%;
        padding: 15px;
    }
    
    .job-card {
        grid-template-columns: 1fr;
        gap: 15px;
        min-height: auto;
    }
    
    .browser-column {
        order: -1;
    }
    
    .mini-browser-frame {
        min-height: 250px;
    }
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header-actions {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0;
    }
    
    .job-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .job-actions {
        width: 100%;
        flex-direction: row;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
    
    .manual-controls {
        flex-direction: column;
    }
    
    .card {
        padding: 20px;
    }
    
    .mini-browser-header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }
    
    .browser-controls {
        align-self: flex-end;
    }
    
    .job-detail {
        padding: 6px 0;
    }
    
    .job-card {
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .job-actions {
        flex-direction: column;
    }
    
    .job-actions form {
        width: 100%;
    }
    
    .job-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    .job-header h3 {
        font-size: 16px;
    }
    
    .job-details {
        max-height: 200px;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mt-10 {
    margin-top: 10px;
}

.mb-10 {
    margin-bottom: 10px;
}

.ml-10 {
    margin-left: 10px;
}

.mr-10 {
    margin-right: 10px;
}

.hidden {
    display: none !important;
}

/* Focus States for Accessibility */
.btn:focus,
input:focus,
select:focus,
button:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Browser Container */
.browser-container {
    position: relative;
    height: 100%;
    min-height: 300px;
}

.mini-browser-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

.iframe-fallback {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px dashed #dee2e6;
}

.fallback-content {
    text-align: center;
    padding: 20px;
}

.fallback-content.error {
    color: #dc3545;
}

.fallback-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.fallback-content p {
    margin-bottom: 15px;
    color: #6c757d;
}

/* Loading animation */
.loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 2s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}