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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #e0e0e0;
    min-height: 100vh;
    color: #333;
    line-height: 1.6;
}

/* ==================== INDEX PAGE ==================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.header {
    text-align: center;
    margin-bottom: 50px;
}

.header h1 {
    color: #c62828;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    font-size: 1.2rem;
}

/* Companies Grid */
.companies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
    padding: 20px 0;
}

/* Company Card */
.company-card {
    background: #fff;
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    border: 2px solid transparent;
}

.company-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border-color: #c62828;
}

.company-logo {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.company-initial {
    font-size: 2rem;
    font-weight: bold;
    color: #fff;
}

.company-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

/* Company Colors */
.company-card.avis .company-logo {
    background: #d32f2f;
}

.company-card.budget .company-logo {
    background: #f57c00;
}

.company-card.sixt .company-logo {
    background: #e65100;
}

.company-card.garenta .company-logo {
    background: #c62828;
}

.company-card.europcar .company-logo {
    background: #2e7d32;
}

.company-card.enterprise .company-logo {
    background: #00695c;
}

.company-card.rentgo .company-logo {
    background: #6a1b9a;
}

.company-card.cizgi .company-logo {
    background: #c62828;
}

.company-card.greenmotion .company-logo {
    background: #558b2f;
}

.footer {
    text-align: center;
    margin-top: 50px;
    color: #666;
    font-size: 0.9rem;
}

/* ==================== CONTRACT PAGE ==================== */
.contract-page {
    max-width: 800px;
    margin: 20px auto;
    background: #fff;
    padding: 25px 35px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
}

/* Contract Header */
.contract-header {
    text-align: center;
    margin-bottom: 15px;
}

.company-title {
    font-size: 2.2rem;
    font-weight: bold;
    color: #c62828;
    margin-bottom: 3px;
    letter-spacing: 2px;
}

.contract-type {
    font-size: 0.95rem;
    font-weight: 600;
    color: #333;
    letter-spacing: 2px;
}

/* Date Section */
.date-section {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-section label {
    font-size: 0.85rem;
}

.date-section input[type="date"] {
    padding: 5px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: inherit;
}

/* Contract Content */
.contract-content {
    margin-bottom: 15px;
}

.contract-article {
    margin-bottom: 10px;
    text-align: justify;
    font-size: 0.8rem;
    line-height: 1.5;
}

.contract-article .article-number {
    font-weight: bold;
}

.contract-article .sub-item {
    display: block;
    margin-left: 15px;
    margin-top: 3px;
}

.contract-note {
    margin-top: 12px;
    font-size: 0.8rem;
}

.contract-note .note-label {
    font-weight: bold;
}

.contract-note .note-highlight {
    display: block;
    margin-top: 6px;
    font-weight: bold;
}

/* Signature Area */
.signature-area {
    display: flex;
    justify-content: center;
    align-items: stretch;
    margin-top: 20px;
    gap: 50px;
}

.company-box {
    border: 2px solid #c62828;
    border-radius: 6px;
    padding: 20px 30px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 3px;
    flex: 1;
    max-width: 280px;
}

.company-box .company-name {
    font-size: 1.1rem;
    font-weight: bold;
    color: #c62828;
}

.company-box .company-full-title {
    font-size: 0.85rem;
    color: #c62828;
    font-weight: 500;
}

.company-box .company-address {
    font-size: 0.75rem;
    color: #666;
    margin-top: 3px;
}

.user-signature {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    max-width: 280px;
}

.signature-field label,
.fullname-field label {
    display: block;
    margin-bottom: 3px;
    font-size: 0.85rem;
}

.signature-canvas-wrapper {
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    overflow: hidden;
}

#signature-pad {
    width: 100%;
    height: 120px;
    display: block;
}

.fullname-field input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.85rem;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Focus States - Erişilebilirlik */
.date-section input[type="date"]:focus,
.fullname-field input:focus {
    outline: none;
    border-color: #c62828;
    box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.15);
}

/* İmza alanı touch-action */
.signature-canvas-wrapper {
    touch-action: none;
}

#signature-pad {
    touch-action: none;
    cursor: crosshair;
}

/* Validation Message */
.validation-message {
    padding: 12px 15px;
    border-radius: 4px;
    margin: 20px 0;
    display: none;
    font-size: 0.9rem;
}

.validation-message.error {
    display: block;
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ef9a9a;
}

.validation-message.success {
    display: block;
    background: #e8f5e9;
    color: #2e7d32;
    border: 1px solid #a5d6a7;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-clear {
    background: #c62828;
    color: #fff;
}

.btn-clear:hover {
    background: #b71c1c;
}

.btn-download {
    background: #c62828;
    color: #fff;
}

.btn-download:hover {
    background: #b71c1c;
}

/* Loading State */
.btn-loading {
    opacity: 0.7;
    cursor: not-allowed;
    position: relative;
}

.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Active/Pressed State */
.btn:active:not(:disabled) {
    transform: scale(0.98);
}

/* Back Link */
.back-link {
    display: block;
    text-align: center;
    margin-top: 25px;
    color: #c62828;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
}

.back-link:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 768px) {
    .contract-page {
        margin: 15px;
        padding: 25px 20px;
    }

    .company-title {
        font-size: 2rem;
    }

    .contract-type {
        font-size: 0.9rem;
        letter-spacing: 1px;
    }

    .signature-area {
        flex-direction: column;
        align-items: center;
    }

    .company-box {
        min-width: auto;
        width: 100%;
    }

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

    .action-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

/* Print & PDF Styles */
@media print {
    .no-print {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .contract-page {
        box-shadow: none;
        margin: 0;
        padding: 20px;
    }
}

/* PDF Mode - Küçük dosya boyutu ve profesyonel sözleşme formatı */
.pdf-mode {
    /* Tüm cihazlarda aynı çıktı için sabit genişlik */
    width: 700px !important;
    max-width: 700px !important;
    min-width: 700px !important;
    padding: 15px 25px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    font-family: 'Times New Roman', Times, Georgia, serif !important;
}

.pdf-mode .no-print {
    display: none !important;
}

.pdf-mode .validation-message {
    display: none !important;
}

/* PDF'de tarih input çerçevesini kaldır */
.pdf-mode .date-section input[type="date"] {
    border: none !important;
    background: transparent !important;
    padding-left: 0 !important;
}

/* PDF'de firma kutusunu tamamen gizle */
.pdf-mode .company-box {
    display: none !important;
}

/* PDF'de imza alanı çerçevesini kaldır */
.pdf-mode .signature-canvas-wrapper {
    border: none !important;
}

/* PDF'de ad soyad input'unu gizle */
.pdf-mode .fullname-field {
    display: none !important;
}

/* PDF modunda signature area düzeni - sadece imza tarafı */
.pdf-mode .signature-area {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 10px !important;
}

.pdf-mode .user-signature {
    flex: none !important;
    max-width: 300px !important;
    width: 300px !important;
}

/* PDF'de imza canvas'ını sola yasla ve boyutunu sınırla */
.pdf-mode .signature-canvas-wrapper {
    border: none !important;
    width: 200px !important;
    max-width: 200px !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
}

.pdf-mode .signature-field {
    text-align: left !important;
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
}

.pdf-mode #signature-pad {
    width: 200px !important;
    height: 60px !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* PDF modunda font boyutlarını küçült - tek sayfaya sığması için */
.pdf-mode .contract-article {
    font-size: 0.75rem !important;
    margin-bottom: 6px !important;
    line-height: 1.5 !important;
    text-align: justify !important;
}

.pdf-mode .company-title {
    font-size: 1.5rem !important;
    margin-bottom: 2px !important;
    font-weight: bold !important;
    letter-spacing: 3px !important;
}

.pdf-mode .contract-type {
    font-size: 0.85rem !important;
    letter-spacing: 1px !important;
    font-weight: 600 !important;
}

.pdf-mode .signed-form-label {
    font-size: 0.9rem !important;
    margin-top: 5px !important;
    font-weight: bold !important;
    letter-spacing: 2px !important;
}

.pdf-mode .contract-header {
    margin-bottom: 10px !important;
    padding-bottom: 8px !important;
    border-bottom: 1px solid #333 !important;
}

.pdf-mode .contract-content {
    margin-bottom: 8px !important;
}

.pdf-mode .contract-note {
    margin-top: 8px !important;
    font-size: 0.7rem !important;
    font-style: italic !important;
}

.pdf-mode .pdf-top-left {
    margin-bottom: 10px !important;
    padding-left: 0 !important;
}

.pdf-mode .pdf-info-line {
    font-size: 0.8rem !important;
    margin-bottom: 2px !important;
}

.pdf-mode .signature-area {
    margin-top: 15px !important;
    padding-top: 10px !important;
    border-top: 1px solid #ccc !important;
}

.pdf-mode .signature-field label,
.pdf-mode .pdf-signature-line {
    font-size: 0.8rem !important;
}

.pdf-mode .article-number {
    font-weight: bold !important;
}

.pdf-mode .sub-item {
    margin-left: 20px !important;
    font-size: 0.7rem !important;
}

/* PDF Sol Üst Bilgileri - normalde gizli */
.pdf-top-left {
    display: none;
}

.pdf-mode .pdf-top-left {
    display: block !important;
    margin-bottom: 15px;
}

.pdf-info-line {
    font-size: 0.9rem;
    margin-bottom: 3px;
}

/* İMZALI FORM etiketi - normalde gizli */
.signed-form-label {
    display: none;
}

.pdf-mode .signed-form-label {
    display: block !important;
    font-size: 1rem;
    font-weight: bold;
    color: #333;
    margin-top: 5px;
    letter-spacing: 2px;
}

/* PDF İmza Bilgileri - normalde gizli */
.pdf-signature-info {
    display: none;
}

.pdf-mode .pdf-signature-info {
    display: block !important;
    margin-top: 10px;
}

.pdf-signature-line {
    font-size: 0.85rem;
    margin-bottom: 3px;
}

/* PDF'de tarih seçici alanını gizle */
.pdf-mode .date-section {
    display: none !important;
}