/* ===========================
   Sailing Hearing Request - Styles
   =========================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f5f5f5;
    line-height: 1.6;
    color: #333;
    overflow-x: hidden;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.header {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    color: white;
    padding: 20px;
    text-align: center;
}

.union-logo {
    width: 60px;
    height: 60px;
    background: white;
    border-radius: 50%;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #1e3a8a;
    overflow: hidden;
}

.union-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.sailing-notice-board-language-flags {
    text-align: center;
    padding: 15px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
}

.sailing-notice-board-language-flags a {
    width: 35px;
    height: 35px;
    display: inline-block;
    margin: 0 5px;
    border-radius: 4px;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sailing-notice-board-language-flags a:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.sailing-notice-board-language-flags .flag-ua {
    background: url('/Content/images/ua.png') no-repeat center center;
    background-size: cover;
}

.sailing-notice-board-language-flags .flag-fr {
    background: url('/Content/images/fr.png') no-repeat center center;
    background-size: cover;
}

.sailing-notice-board-language-flags .flag-he {
    background: url('/Content/images/he.png') no-repeat center center;
    background-size: cover;
}

.sailing-notice-board-language-flags .flag-en {
    background: url('/Content/images/en.png') no-repeat center center;
    background-size: cover;
}

.sailing-notice-board-language-flags .flag-es {
    background: url('/Content/images/es.png') no-repeat center center;
    background-size: cover;
}

.form-container {
    padding: 20px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.form-section {
    margin-bottom: 30px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    background: #fafafa;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: #1e3a8a;
    margin-bottom: 15px;
    border-bottom: 2px solid #3b82f6;
    padding-bottom: 5px;
}

.form-group {
    margin-bottom: 15px;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #374151;
}

.required {
    color: #ef4444;
}

.form-control {
    width: 100%;
    max-width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 16px;
    background: white;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    height: 48px;
    line-height: 1.5;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0;
}

.form-control:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-control:disabled {
    background-color: #f3f4f6;
    color: #6b7280;
    cursor: not-allowed;
}

select.form-control {
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
    padding-right: 40px;
    padding-left: 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
}

select.form-control option {
    padding: 8px 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
    height: auto;
    padding-top: 12px;
    padding-bottom: 12px;
    white-space: normal;
}

.form-control::placeholder {
    color: #9ca3af;
    opacity: 1;
    line-height: 1.5;
    vertical-align: middle;
}

.form-control::-webkit-input-placeholder {
    color: #9ca3af;
    opacity: 1;
    line-height: 1.5;
}

.form-control::-moz-placeholder {
    color: #9ca3af;
    opacity: 1;
    line-height: 1.5;
}

.form-control:-ms-input-placeholder {
    color: #9ca3af;
    opacity: 1;
    line-height: 1.5;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    background: white;
    padding: 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
    min-width: 250px;
}

.checkbox-item:hover {
    background: #f3f4f6;
}

.checkbox-item input[type="checkbox"] {
    margin-right: 8px;
    margin-left: 0;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.checkbox-item label {
    margin: 0;
    cursor: pointer;
    font-weight: 400;
    flex: 1;
}

.respondent-section {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 15px;
    background: white;
    width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.respondent-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.remove-respondent {
    background: #ef4444;
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.add-respondent {
    background: #10b981;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 10px;
}

.file-upload {
    position: relative;
    display: inline-block;
    cursor: pointer;
    width: 100%;
}

.file-upload input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

.file-upload-label {
    display: block;
    padding: 12px;
    border: 2px dashed #d1d5db;
    border-radius: 6px;
    text-align: center;
    background: #f9fafb;
    transition: all 0.2s;
}

.file-upload:hover .file-upload-label {
    border-color: #3b82f6;
    background: #eff6ff;
}

.canvas-container {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    margin-top: 10px;
}

#drawingCanvas {
    display: block;
    cursor: crosshair;
    width: 100%;
    height: 200px;
    border-radius: 6px;
}

.canvas-controls {
    padding: 10px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 10px;
}

.canvas-controls .canvas-text {
    text-align: center;
}

.canvas-controls button {
    padding: 5px 10px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    margin-left: auto;
}

.submit-btn {
    width: 100%;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
}

.submit-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.submit-btn:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    max-width: 400px;
    width: 90%;
}

.modal-icon {
    width: 60px;
    height: 60px;
    background: #10b981;
    border-radius: 50%;
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

.crew-names {
    display: none;
    margin-top: 15px;
    padding: 15px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
}

.row {
    display: flex;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
    align-items: flex-start;
}

.col-half {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

.col-half .form-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #374151;
    width: 100%;
}

.col-half .form-control {
    width: 100%;
    box-sizing: border-box;
}

.section-active {
    border-color: #3b82f6;
    background: #eff6ff;
}

.section-inactive {
    opacity: 0.6;
}

.info-box {
    background: #dbeafe;
    border: 1px solid #3b82f6;
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 15px;
}

.info-box-icon {
    color: #3b82f6;
    margin-right: 8px;
}

fieldset {
    margin: 0;
    padding: 0;
    border: 0;
}

/* RTL Support */
[dir="rtl"] select.form-control {
    background-position: left 12px center;
    padding-right: 12px;
    padding-left: 40px;
}

[dir="rtl"] .checkbox-item input[type="checkbox"] {
    margin-right: 0;
    margin-left: 8px;
}

[dir="rtl"] .checkbox-item label {
    text-align: right;
}

[dir="rtl"] .canvas-controls button {
    margin-left: 0;
    margin-right: auto;
}

[dir="rtl"] .info-box-icon {
    margin-right: 0;
    margin-left: 8px;
}

[dir="rtl"] .form-label,
[dir="rtl"] .section-title,
[dir="rtl"] .info-box,
[dir="rtl"] .form-control {
    text-align: right;
}

[dir="rtl"] .header {
    text-align: center;
}

[dir="rtl"] .modal-content {
    text-align: center;
}

[dir="rtl"] .form-control {
    text-align: right;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

[dir="rtl"] .form-group {
    width: 100%;
    box-sizing: border-box;
}

[dir="rtl"] .form-section {
    width: 100%;
    box-sizing: border-box;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .row {
        flex-direction: column;
    }

    .container {
        margin: 0;
        width: 100%;
        max-width: 100%;
        padding: 0;
    }

    .form-container {
        padding: 15px;
        width: 100%;
        box-sizing: border-box;
    }

    .form-section {
        padding: 15px;
        margin-bottom: 20px;
        width: 100%;
        box-sizing: border-box;
    }

    .form-group {
        width: 100%;
        box-sizing: border-box;
    }

    .form-control {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        font-size: 16px;
    }

    select.form-control {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding-right: 35px;
        padding-left: 10px;
    }

    [dir="rtl"] select.form-control {
        padding-right: 10px;
        padding-left: 35px;
    }

    select.form-control option {
        white-space: normal;
        word-wrap: break-word;
    }

    .checkbox-group {
        flex-direction: column;
    }

    .checkbox-item {
        min-width: 100%;
        padding: 15px;
        font-size: 14px;
    }

    .sailing-notice-board-language-flags {
        padding: 10px 15px;
    }

    .sailing-notice-board-language-flags a {
        width: 30px;
        height: 30px;
        margin: 0 3px;
    }

    .respondent-header {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .canvas-controls {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    .canvas-controls button {
        width: 100%;
        padding: 10px;
    }

    [dir="rtl"] .row {
        flex-direction: column;
    }
}

/* Global box-sizing reset */
* {
    max-width: 100%;
    box-sizing: border-box;
}