/* 
  Ghana Education Service - Personal Record Form
  Main Stylesheet
*/

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

body {
    font-family: 'Roboto', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f9f9f9; /* Lighter background */
}

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

.hidden {
    display: none !important;
}

/* -----------------------------
   Typography
----------------------------- */
h1, h2, h3, h4 {
    font-weight: 700;
    margin-bottom: 15px;
    color: #006B3F; /* Ghana flag green */
}

h1 {
    font-size: 24px;
    text-align: center;
    text-transform: uppercase;
}

h2 {
    font-size: 20px;
    text-align: center;
}

h3 {
    font-size: 18px;
    padding: 10px 0;
    border-bottom: 2px solid #006B3F;
    margin-top: 20px;
}

p {
    margin-bottom: 15px;
}

/* -----------------------------
   Welcome Screen
----------------------------- */
#welcome-screen {
    text-align: center;
    margin: 80px auto;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.welcome-header {
    margin-bottom: 20px;
}

.welcome-coa {
    width: 150px;
    height: auto;
    margin-bottom: 25px;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
}

#welcome-screen h1 {
    color: #006B3F; /* Ghana green */
    margin-bottom: 15px;
    font-size: 42px;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

#welcome-screen h2 {
    color: #333;
    margin-bottom: 15px;
    font-size: 28px;
    font-weight: 500;
}

#welcome-screen p {
    margin-bottom: 40px;
    font-size: 18px;
    color: #333;
}

#open-form-btn {
    background-color: #006B3F; /* Ghana green */
    font-size: 18px;
    padding: 14px 30px;
    transition: all 0.3s ease;
    border-radius: 6px;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.welcome-footer {
    margin-top: 60px;
    width: 100%;
    text-align: center;
}

.welcome-footer p {
    font-size: 14px !important;
    color: #666 !important;
    margin-bottom: 0 !important;
}

.welcome-footer strong {
    color: #006B3F;
    font-weight: 700;
}

#open-form-btn:hover {
    background-color: #005a36;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

/* -----------------------------
   Form Container and Sections
----------------------------- */
#form-container {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    padding: 30px;
    margin-bottom: 40px;
}

/* -----------------------------
   Progress Tracker
----------------------------- */
.progress-tracker {
    margin-bottom: 30px;
}

.progress-panel {
    background-color: #f9f9f9;
    border-radius: 5px;
    padding: 15px;
    border: 1px solid #e0e0e0;
    margin-bottom: 25px;
}

.progress-container {
    width: 100%;
    background-color: #f1f1f1;
    border-radius: 4px;
    margin: 8px 0 15px;
    overflow: hidden;
    position: relative;
    height: 20px;
}

.progress-bar {
    height: 100%;
    background-color: #ddd;
    width: 0;
    transition: width 0.5s ease;
}

.progress-info {
    display: flex;
    align-items: center;
    font-size: 16px;
    font-weight: 600;
    color: #444;
}

.progress-title {
    margin-right: 5px;
}

.progress-percentage {
    font-weight: 600;
}

.progress-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 15px;
}

.progress-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 15px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
}

.progress-btn .icon-save,
.progress-btn .icon-load,
.progress-btn .icon-clear {
    margin-right: 5px;
    font-size: 14px;
}

.save-btn {
    background-color: #5a6268;
}

.save-btn:hover {
    background-color: #484e53;
}

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

.load-btn:hover {
    background-color: #5a6268;
}

.clear-btn {
    background-color: #dc3545;
}

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

/* Add font icons */
.icon-save:before {
    content: "📥";
}

.icon-load:before {
    content: "📤";
}

.icon-clear:before {
    content: "🗑️";
}

/* Section markers removed as requested */

.form-header {
    margin-bottom: 30px;
}

.logo-photo-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
}

.coa-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 10px auto;
    width: 100%;
}

.ghana-coa {
    width: 80px;
    height: auto;
    display: block;
}

.spacer {
    flex: 1;
}

.photo-container {
    width: 150px;
    height: 180px;
    border: 1px solid #ddd;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#photo-preview {
    width: 100%;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid #ddd;
    overflow: hidden;
}

#photo-preview img {
    max-width: 100%;
    max-height: 100%;
}

#photo-preview p {
    font-weight: bold;
    color: #999;
}

.form-section {
    margin-bottom: 30px;
    border: 1px solid #eee;
    padding: 20px;
    border-radius: 5px;
}

.section-description {
    font-style: italic;
    font-size: 14px;
    margin-bottom: 15px;
}

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

.form-group {
    flex: 1;
    min-width: 200px;
}

.form-group.wide {
    flex-basis: 100%;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

/* Regular form inputs */
input[type="text"],
input[type="tel"],
input[type="date"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Roboto', Arial, sans-serif;
    font-size: 14px;
}

/* PDF style with underlines */
.pdf-form-field {
    border: none;
    border-bottom: 1px solid #000;
    border-radius: 0;
    padding: 5px 0;
    background-color: transparent;
}

input[type="text"]:focus,
input[type="tel"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #006B3F;
    box-shadow: 0 0 0 2px rgba(0, 107, 63, 0.2);
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    margin-right: 15px;
}

.checkbox-item input[type="checkbox"],
.checkbox-item input[type="radio"] {
    margin-right: 5px;
}

.checkbox-item input[type="text"] {
    width: 150px;
    margin-left: 5px;
}

/* -----------------------------
   Tables
----------------------------- */
.table-container {
    margin-top: 15px;
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th, table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
}

table th {
    background-color: #f5f5f5;
    font-weight: 600;
}

table input, table select {
    border: none;
    width: 100%;
    padding: 5px;
    font-family: inherit;
    font-size: inherit;
}

table input:focus, table select:focus {
    outline: none;
    background-color: #f0f9f4;
}

.add-row-container {
    margin-top: 10px;
    display: flex;
    justify-content: flex-end;
}

/* -----------------------------
   Buttons
----------------------------- */
.primary-btn, .secondary-btn, .add-btn, .remove-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Roboto', Arial, sans-serif;
    font-weight: 500;
    font-size: 16px;
    transition: all 0.3s ease;
}

.primary-btn {
    background-color: #006B3F;
    color: white;
}

.primary-btn:hover {
    background-color: #005a36;
}

.secondary-btn {
    background-color: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
}

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

.add-btn {
    background-color: #FCD116; /* Ghana flag yellow */
    color: #333;
    font-size: 14px;
    padding: 8px 15px;
}

.add-btn:hover {
    background-color: #f0c507;
}

.remove-btn {
    background-color: #CE1126; /* Ghana flag red */
    color: white;
    font-size: 14px;
    padding: 5px 10px;
}

.remove-btn:hover {
    background-color: #b00e20;
}

#upload-photo-btn {
    margin-top: 10px;
    font-size: 14px;
    padding: 5px 10px;
}

/* -----------------------------
   Form Actions
----------------------------- */
.form-actions {
    display: flex;
    justify-content: center;
    padding: 20px 0;
    gap: 15px;
}

.action-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.form-data-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.pdf-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* -----------------------------
   Signature Section
----------------------------- */
.signature-container {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    margin-bottom: 30px;
}

.signature-box {
    flex: 1;
    max-width: 45%;
    text-align: center;
}

.signature-canvas-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 10px;
    width: 100%;
}

.signature-pad {
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #fff;
    margin-bottom: 10px;
    cursor: crosshair;
    width: 100%;
    height: 100px;
}

.signature-actions {
    display: flex;
    gap: 10px;
    margin-top: 5px;
}

.sign-btn {
    background-color: #4CAF50;
    color: white;
    padding: 5px 15px;
    font-size: 14px;
}

.clear-sign-btn {
    background-color: #f44336;
    color: white;
    padding: 5px 15px;
    font-size: 14px;
}

.signature-modal-content {
    max-width: 600px;
}

.signature-modal-container {
    display: flex;
    justify-content: center;
    padding: 10px;
    margin: 15px 0;
}

#signature-modal-pad {
    border: 1px solid #000;
    border-radius: 5px;
    background-color: #fff;
    cursor: crosshair;
}

.signature-modal-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
}

.signature-line {
    border-bottom: 1px solid #000;
    margin-bottom: 8px;
    width: 100%;
    height: 40px;
    display: none;
}

/* PDF Signature Section */
.pdf-signature-container {
    display: flex;
    justify-content: space-between;
    margin-top: 40px;
    page-break-inside: avoid;
}

.pdf-signature-box {
    flex: 1;
    max-width: 45%;
    text-align: center;
}

.pdf-signature-line {
    border-bottom: 1px solid #000;
    margin-bottom: 8px;
    width: 100%;
    height: 20px;
}

.pdf-signature-title {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 12px;
}

.pdf-signature-date {
    font-size: 12px;
}

/* -----------------------------
   PDF Generation and Download
----------------------------- */
#pdf-container {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    padding: 40px;
    text-align: center;
    margin: 60px auto;
    max-width: 600px;
}

.pdf-message h2 {
    color: #006B3F;
    margin-bottom: 20px;
}

.warning {
    color: #CE1126;
    font-weight: 500;
    margin-bottom: 30px;
    padding: 10px;
    background-color: #fff8f8;
    border-left: 4px solid #CE1126;
}

/* -----------------------------
   Validation Styles
----------------------------- */
.error {
    border-color: #CE1126 !important;
}

.error-message {
    color: #CE1126;
    font-size: 12px;
    margin-top: 5px;
}

/* -----------------------------
   Image Cropper Modal
----------------------------- */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.preview-modal-content {
    max-width: 800px;
    padding: 15px;
}

#preview-container {
    margin: 20px 0;
    height: 70vh;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 10px;
    background-color: #f9f9f9;
}

.preview-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.close-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
}

.cropper-container {
    width: 100%;
    height: 400px;
    margin: 20px 0;
}

#image-to-crop {
    max-width: 100%;
    display: block;
}

.cropper-controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

/* -----------------------------
   Tooltips
----------------------------- */
.tooltip-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: #006B3F;
    color: white;
    font-size: 12px;
    font-weight: bold;
    margin-left: 8px;
    cursor: help;
    position: relative;
    vertical-align: middle;
}

.tooltip-text {
    position: absolute;
    visibility: hidden;
    width: 250px;
    background-color: #555;
    color: #fff;
    text-align: center;
    padding: 10px;
    border-radius: 6px;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.3s;
    font-weight: normal;
    font-size: 12px;
    letter-spacing: normal;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
}

.tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #555 transparent transparent transparent;
}

.tooltip-icon:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* -----------------------------
   Footer
----------------------------- */
.company-footer {
    width: 100%;
    background-color: #f7f7f7;
    border-top: 1px solid #ddd;
    padding: 15px 0;
    margin-top: 30px;
    text-align: center;
    font-size: 12px;
    color: #555;
}

.company-footer p {
    margin: 5px 0;
}

.company-footer strong {
    color: #006B3F;
    font-weight: 600;
}

/* -----------------------------
   Touch-Friendly Interface
----------------------------- */
/* Base touch device styles */
.touch-device {
    /* Slightly increase base font size for better readability on mobile */
    font-size: 16px;
}

/* Larger touch targets for inputs */
.touch-friendly-control {
    width: 24px;
    height: 24px;
    margin-right: 10px;
    vertical-align: middle;
}

.touch-control-wrapper {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    min-height: 36px;
}

/* Enhanced dropdowns for touch */
.touch-friendly-dropdown {
    height: 44px;
    padding: 0 15px;
    background-size: 14px;
    background-position: right 12px center;
}

/* Date inputs enhancement */
.touch-friendly-date {
    height: 44px;
    padding: 0 15px;
}

/* Larger buttons for touch */
.touch-friendly-button {
    min-height: 44px;
    padding: 10px 20px;
    margin: 5px 0;
    touch-action: manipulation;
}

/* Form input touch states */
.touch-focus {
    box-shadow: 0 0 0 3px rgba(0, 107, 63, 0.3);
}

/* Enhanced signature pads */
.touch-signature-pad {
    border-width: 2px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.touch-signature-instructions {
    margin: 8px 0;
    font-size: 14px;
    color: #666;
    text-align: center;
    font-style: italic;
}

/* Touch-friendly modals */
.touch-friendly-modal .modal-content {
    padding: 20px;
}

.touch-friendly-modal .close-modal {
    font-size: 28px;
    padding: 10px;
}

/* Mobile table enhancements */
.touch-swipe-table {
    position: relative;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 15px;
}

.swipe-indicator {
    position: absolute;
    bottom: 0;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
    display: flex;
    align-items: center;
    animation: pulse 2s infinite;
    z-index: 5;
}

.swipe-indicator span {
    margin-right: 5px;
}

.swipe-indicator svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: white;
    stroke-width: 2;
}

.hide-indicator {
    opacity: 0;
    transition: opacity 0.5s;
}

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

/* Table button enhancements */
.touch-add-button {
    padding: 12px 24px;
    margin: 10px 0;
}

.touch-remove-button {
    width: 40px;
    height: 40px;
    font-size: 18px;
}

/* Scroll to top button */
.scroll-to-top-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #006B3F;
    color: white;
    font-size: 24px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 1000;
}

.show-scroll-btn {
    opacity: 1;
    visibility: visible;
}

/* Mobile section navigation */
.mobile-nav-container {
    margin: 15px 0;
    padding: 0 10px;
    display: none;
}

.mobile-section-nav {
    width: 100%;
    height: 44px;
    padding: 0 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f9f9f9;
    font-size: 16px;
    color: #333;
}

/* -----------------------------
   Media Queries
----------------------------- */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    #form-container {
        padding: 15px;
    }

    .form-row {
        flex-direction: column;
    }

    .form-group {
        min-width: 100%;
    }

    .logo-photo-container {
        flex-direction: column;
        align-items: center;
        gap: 20px;
    }

    .signature-container {
        flex-direction: column;
        align-items: center;
        gap: 30px;
    }

    .signature-box {
        max-width: 100%;
    }

    .checkbox-group {
        flex-direction: column;
        align-items: flex-start;
    }
    
    /* Show mobile navigation on small screens */
    .mobile-nav-container {
        display: block;
    }
    
    /* Increase button size on mobile */
    .primary-btn, .secondary-btn, .add-btn, button[type="button"] {
        padding: 12px 20px;
        min-height: 44px;
        font-size: 16px;
    }
    
    /* Increase form spacing on mobile */
    .form-section {
        margin-bottom: 30px;
        padding-bottom: 25px;
    }
    
    /* Enhance form inputs on mobile */
    input, select, textarea {
        font-size: 16px; /* Prevents iOS zoom on focus */
        height: 44px;
    }
    
    /* Make table headers sticky on mobile if scrolling horizontally */
    .table-container table thead th {
        position: sticky;
        top: 0;
        background-color: #f8f8f8;
        z-index: 1;
    }
    
    /* Better tooltips on mobile */
    .tooltip-text {
        width: 200px;
    }
}
