/* CalliLines Tool Styles */

/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Aref+Ruqaa:wght@400;700&display=swap');

/* Font face declarations for local fonts */
@font-face {
    font-family: 'Tajawal';
    src: url('/uac_website_tools/static/src/fonts/Tajawal-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

@font-face {
    font-family: 'Aref Ruqaa';
    src: url('/uac_website_tools/static/src/fonts/ArefRuqaa-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

/* Main container - Optimized for fast rendering */
#callilines-embed {
    background: none;
    width: 100%;
    min-height: 500px;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

#callilines-embed * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

/* Container - Light Mode */
#callilines-embed .container {
    max-width: 1400px;
    margin: 20px auto;
    padding: 30px;
    background: #fff;
    color: #212529;
    border-radius: 8px;
    text-align: left;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: block !important; /* Force visibility */
    min-height: 400px; /* Ensure minimum height */
}

/* Fieldsets */
#callilines-embed fieldset {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 25px;
    background: #fff;
    color: #212529;
}

/* Fieldset Legend - Light Mode */
#callilines-embed fieldset legend {
    font-weight: 600;
    color: #212529;
    font-size: 1.1rem;
    padding: 0 15px;
    background: #fff;
    border-radius: 4px;
}

/* Light mode explicit support */
@media (prefers-color-scheme: light) {
    /* Container - Light Mode */
    #callilines-embed .container {
        color: #212529 !important;
        background: #fff !important;
        border: 1px solid #e9ecef !important;
    }

    /* Fieldsets - Light Mode */
    #callilines-embed fieldset {
        background: #fff !important;
        border-color: #e9ecef !important;
    }

    /* Fieldset Legends - Light Mode */
    #callilines-embed fieldset legend {
        background: #fff !important;
        color: #212529 !important;
    }

    /* Form Inputs - Light Mode */
    #callilines-embed .form-group input,
    #callilines-embed .form-group select {
        background: #fff !important;
        color: #212529 !important;
        border-color: #e9ecef !important;
    }

    /* Labels - Light Mode */
    #callilines-embed .form-group label,
    #callilines-embed label,
    #callilines-embed fieldset legend {
        color: #2e2e2e !important;
        font-weight: 600 !important;
    }

    /* All Inputs - Light Mode */
    #callilines-embed input,
    #callilines-embed select,
    #callilines-embed textarea,
    #callilines-embed .form-group input[type="file"] {
        background: #fff !important;
        border-color: #e9ecef !important;
        color: #2e2e2e !important;
    }

    /* All Text Elements - Light Mode */
    #callilines-embed,
    #callilines-embed *,
    #callilines-embed .container,
    #callilines-embed .form-group,
    #callilines-embed fieldset {
        color: #2e2e2e !important;
    }

    /* Calculated Spacing - Light Mode */
    #callilines-embed .calculated-spacing {
        background: #f8f9fa !important;
        color: #212529 !important;
        border-color: #e9ecef !important;
    }

    /* Calculated Spacing Spans - Light Mode */
    #callilines-embed .calculated-spacing span {
        color: #0d6efd !important;
    }

    /* Layout preservation - Light Mode */
    #callilines-embed .form-row {
        display: flex !important;
        flex-wrap: wrap !important;
        flex-direction: row !important;
        gap: 10px !important;
        margin-bottom: 20px !important;
        align-items: flex-start !important;
        justify-content: flex-start !important;
    }

    #callilines-embed .form-group {
        flex: 1 1 auto !important;
        min-width: 180px !important;
        max-width: none !important;
        display: flex !important;
        flex-direction: column !important;
        position: relative !important;
        margin-bottom: 15px !important;
        margin-right: 10px !important;
    }

    #callilines-embed fieldset .form-row {
        width: 100% !important;
    }
}



/* Default text colors - Fallback for light mode */
#callilines-embed {
    color: #2e2e2e;
}

#callilines-embed label,
#callilines-embed .form-group label,
#callilines-embed fieldset legend {
    color: #2e2e2e !important;
    font-weight: 600;
}

#callilines-embed input,
#callilines-embed select,
#callilines-embed textarea {
    color: #2e2e2e !important;
    background: #fff;
    border: 1px solid #e9ecef;
}

/* Form layout - Optimized for better organization */
#callilines-embed .form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    align-items: flex-start;
    justify-content: flex-start;
}

/* Ensure fields fill available space properly */
#callilines-embed .form-row .form-group:last-child {
    margin-right: 0;
}

/* Special handling for sections with fewer fields to fill space better */
#callilines-embed fieldset .form-row {
    width: 100%;
}



#callilines-embed .form-group {
    flex: 1 1 auto;
    min-width: 180px;
    max-width: none;
    display: flex;
    flex-direction: column;
    position: relative;
    margin-bottom: 15px;
    margin-right: 10px;
}

/* Labels - Light Mode */
#callilines-embed .form-group label {
    font-weight: 600;
    color: #212529;
    margin-bottom: 8px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 5px;
    visibility: visible;
    opacity: 1;
}

/* Tooltip */
#callilines-embed .form-group .tooltip {
    position: relative;
    display: inline-block;
    cursor: pointer;
    font-size: 0.8rem;
    color: #5563DE;
}

#callilines-embed .form-group .tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    font-size: 0.8rem;
    padding: 5px 10px;
    border-radius: 6px;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

/* Form inputs */
#callilines-embed .form-group input,
#callilines-embed .form-group select {
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 12px 15px;
    font-size: 0.95rem;
    width: 100%;
    min-width: 160px;
    background: #fff;
    color: #212529;
    transition: border-color 0.3s, box-shadow 0.3s;
    outline: none;
}

#callilines-embed .form-group input:focus,
#callilines-embed .form-group select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

#callilines-embed .form-group input:focus,
#callilines-embed .form-group select:focus {
    border-color: #5563DE;
    box-shadow: 0 0 0 3px rgba(85, 99, 222, 0.1);
}

/* Color inputs */
#callilines-embed .form-group input[type="color"] {
    height: 42px;
    padding: 4px;
    cursor: pointer;
}

/* File inputs */
#callilines-embed .form-group input[type="file"] {
    padding: 10px;
    border: 2px dashed var(--bs-border-color, #ddd);
    background: var(--bs-secondary-bg, #f9f9f9);
    color: var(--bs-body-color, #212529);
    cursor: pointer;
}

#callilines-embed .form-group input[type="file"]:hover {
    border-color: #5563DE;
    background: var(--bs-primary-bg-subtle, #f0f4ff);
}

/* Number inputs */
#callilines-embed .form-group input[type="number"] {
    text-align: center;
}

/* Checkbox inputs */
#callilines-embed .form-group input[type="checkbox"] {
    width: auto;
    min-width: auto;
    margin-right: 10px;
    transform: scale(1.2);
}

/* Buttons */
#callilines-embed .btn {
    background: linear-gradient(135deg, #5563DE, #4A90E2);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 12px 24px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#callilines-embed .btn:hover {
    background: linear-gradient(135deg, #4A52C7, #3A7BC8);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(85, 99, 222, 0.3);
}

#callilines-embed .btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(85, 99, 222, 0.2);
}

/* Secondary button */
#callilines-embed .btn-secondary {
    background: linear-gradient(135deg, #6c757d, #5a6268);
}

#callilines-embed .btn-secondary:hover {
    background: linear-gradient(135deg, #5a6268, #495057);
}

/* Success button */
#callilines-embed .btn-success {
    background: linear-gradient(135deg, #28a745, #20c997);
}

#callilines-embed .btn-success:hover {
    background: linear-gradient(135deg, #218838, #1abc9c);
}

/* Canvas and preview area */
#callilines-embed .canvas-container {
    margin: 20px 0;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

#callilines-embed .canvas-header {
    background: #f8f9fa;
    padding: 15px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#callilines-embed .canvas-header h3 {
    margin: 0;
    color: #495057;
    font-size: 1.1rem;
}

#callilines-embed .canvas-content {
    padding: 20px;
    min-height: 400px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Calculated spacing display - Light Mode */
#callilines-embed .calculated-spacing {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    margin: 25px 0;
    font-weight: 600;
    color: #42484e;
    border: 1px solid #e9ecef;
    display: block;
    visibility: visible;
    font-size: 1.2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Calculated spacing spans - Light Mode */
#callilines-embed .calculated-spacing span {
    color: #0d6efd;
}

#callilines-embed .calculated-spacing span {
    margin: 0 15px;
    color: #0d6efd;
    font-weight: 700;
}

#callilines-embed .calculated-spacing span:nth-child(2) {
    color: #6c757d;
    font-weight: 400;
    margin: 0 20px;
}

/* Output area */
#callilines-embed .output-section {
    margin-top: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

#callilines-embed .output-section h3 {
    margin-bottom: 15px;
    color: #495057;
    font-size: 1.1rem;
}

#callilines-embed .output-content {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.4;
    max-height: 300px;
    overflow-y: auto;
}

/* Status messages */
#callilines-embed .status-message {
    padding: 12px 16px;
    border-radius: 6px;
    margin: 15px 0;
    font-weight: 500;
}

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

#callilines-embed .status-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

#callilines-embed .status-message.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Progress indicator */
#callilines-embed .progress-container {
    margin: 20px 0;
}

#callilines-embed .progress-bar {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

#callilines-embed .progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #5563DE, #4A90E2);
    transition: width 0.3s ease;
    width: 0%;
}

/* Responsive design */
@media (max-width: 768px) {
    #callilines-embed .container {
        margin: 10px;
        padding: 20px;
    }

    #callilines-embed .form-row {
        flex-direction: column;
        gap: 10px;
    }

    #callilines-embed .form-group {
        min-width: auto;
        max-width: none;
        margin-right: 0;
    }

    #callilines-embed fieldset {
        padding: 12px;
    }
    
    #callilines-embed .canvas-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    #callilines-embed .btn {
        width: 100%;
        margin: 5px 0;
    }
}

@media (max-width: 480px) {
    #callilines-embed .container {
        margin: 5px;
        padding: 10px;
    }
    
    #callilines-embed .canvas-content {
        padding: 10px;
        min-height: 300px;
    }
    
    #callilines-embed .output-section {
        padding: 15px;
    }
}

/* Preview section is hidden by default */
#callilines-embed .preview-section {
    margin-top: 30px;
    text-align: center;
    display: none; /* Hide initially */
}

#callilines-embed .preview-section h3 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

#callilines-embed .preview-section canvas {
    border: 1px solid #ddd;
    border-radius: 8px;
    max-width: 100%;
    height: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Button styles */
#callilines-embed .button-row {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 30px 0;
    flex-wrap: wrap;
}

#callilines-embed .button-row button {
    background: linear-gradient(135deg, #5563DE, #3b47a8);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(85, 99, 222, 0.3);
}

#callilines-embed .button-row button:hover {
    background: linear-gradient(135deg, #3b47a8, #2a3490);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(85, 99, 222, 0.4);
}

#callilines-embed .button-row button:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(85, 99, 222, 0.3);
}
